]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/25213 ([3.4 only] -fpic/-fPIC testsuite failures in gcc.dg/i386-387...
authorRoger Sayle <roger@eyesopen.com>
Sat, 31 Dec 2005 00:39:42 +0000 (00:39 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sat, 31 Dec 2005 00:39:42 +0000 (00:39 +0000)
PR target/25213
Backport from mainline
2005-09-06  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/23098
* cse.c (fold_rtx_mem): Call delegitimize_address target hook.
* simplify-rtx.c (constant_pool_reference_p): New function.
* rtl.h (constant_pool_reference_p): New prototype.
* config/i386/i386.md (pushf split, mov[sdx]f split): Use
constant_pool_reference_p in condition and
avoid_constant_pool_reference in preparation statements.

* gcc.dg/pr23098.c: Backport testcase from mainline.

From-SVN: r109192

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/cse.c
gcc/rtl.h
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr23098.c [new file with mode: 0644]

index f6ef23390c8af66e26e718edab0aec1d83e7bc0c..6952318a919ff9f2ec55534283b5168804c222d5 100644 (file)
@@ -1,3 +1,17 @@
+2005-12-30  Roger Sayle  <roger@eyesopen.com>
+
+       PR target/25213
+       Backport from mainline
+       2005-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/23098
+       * cse.c (fold_rtx_mem): Call delegitimize_address target hook.
+       * simplify-rtx.c (constant_pool_reference_p): New function.
+       * rtl.h (constant_pool_reference_p): New prototype.
+       * config/i386/i386.md (pushf split, mov[sdx]f split): Use
+       constant_pool_reference_p in condition and
+       avoid_constant_pool_reference in preparation statements.
+
 2005-12-30  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR fortran/25586
index e87a316632378ce5d8227d1fbc358a31ca4ec4c2..0fbe00b66e3c2e54318daaebdda1013c1ec25a19 100644 (file)
        (match_operand:SF 1 "memory_operand" ""))]
   "reload_completed
    && GET_CODE (operands[1]) == MEM
-   && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-   && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+   && constant_pool_reference_p (operands[1])"
   [(set (match_dup 0)
        (match_dup 1))]
-  "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+  "operands[1] = avoid_constant_pool_reference (operands[1]);")
 
 
 ;; %%% Kill this when call knows how to work this out.
    && GET_CODE (operands[1]) == MEM
    && (GET_MODE (operands[0]) == XFmode
        || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
-   && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-   && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+   && constant_pool_reference_p (operands[1])"
   [(set (match_dup 0) (match_dup 1))]
 {
-  rtx c = get_pool_constant (XEXP (operands[1], 0));
+  rtx c = avoid_constant_pool_reference (operands[1]);
   rtx r = operands[0];
 
   if (GET_CODE (r) == SUBREG)
index 447d972c340a82cbef0a2cca8a9fea86ee46a8f8..72af39aa4f3b1f3c45b87863361299b4aa089a8c 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3518,6 +3518,9 @@ fold_rtx (rtx x, rtx insn)
              addr = addr_ent->const_rtx;
          }
 
+       /* Call target hook to avoid the effects of -fpic etc....  */
+       addr = targetm.delegitimize_address (addr);
+
        /* If address is constant, split it into a base and integer offset.  */
        if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
          base = addr;
index d75789fd8217a605f31332d24282f5c2c7407064..c95ac847e6a5d584ed9631fb3e570cc9cd1b57fd 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1639,6 +1639,7 @@ extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
 extern rtx simplify_replace_rtx (rtx, rtx, rtx);
 extern rtx simplify_rtx (rtx);
 extern rtx avoid_constant_pool_reference (rtx);
+extern bool constant_pool_reference_p (rtx);
 
 /* In function.c  */
 extern rtx gen_mem_addressof (rtx, tree, int);
index 7c0263061ae4b4f5fa158a44461f2100ff6506b7..d6d8f89d62ca8a8036ac22e4c356a5e7dfd5c08a 100644 (file)
@@ -188,6 +188,14 @@ simplify_gen_ternary (enum rtx_code code, enum machine_mode mode,
 
   return gen_rtx_fmt_eee (code, mode, op0, op1, op2);
 }
+
+/* Return true if X is a MEM referencing the constant pool.  */
+
+bool
+constant_pool_reference_p (rtx x)
+{
+  return avoid_constant_pool_reference (x) != x;
+}
 \f
 /* Likewise, for relational operations.
    CMP_MODE specifies mode comparison is done in.
index 5de9c3cdec3fa88e6de505cf2ab8f722591089c4..aa0a842a72ad8a9d23c57808e4b44b1f2020043d 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-30  Roger Sayle  <roger@eyesopen.com>
+
+       PR target/25213
+       * gcc.dg/pr23098.c: Backport testcase from mainline.
+
 2005-12-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * g++.dg/rtti/tinfo1.C: Scan for ".global" also.
diff --git a/gcc/testsuite/gcc.dg/pr23098.c b/gcc/testsuite/gcc.dg/pr23098.c
new file mode 100644 (file)
index 0000000..d1750b7
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR rtl-optimization/23098 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-final { scan-assembler-not "\.LC\[0-9\]" } } */
+/* { dg-require-effective-target ilp32 } */
+
+double foo (float);
+
+double
+f1 (void)
+{
+  return foo (1.0);
+}
+
+double
+f2 (void)
+{
+  return foo (0.0);
+}
+
+void
+f3 (float *x, float t)
+{
+  *x = 0.0 + t;
+}