summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/i386/i386.md10
-rw-r--r--gcc/cse.c3
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/simplify-rtx.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr23098.c24
7 files changed, 55 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3ab98bebd50..3bcc27c1179 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+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-09-06 Andreas Krebbel <krebbel1@de.ibm.com>
* gcse.c (try_replace_reg): Disallow REG_EQUAL notes for
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 88440d66183..c1d455a600f 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2247,11 +2247,10 @@
(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.
@@ -2861,11 +2860,10 @@
&& 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)
diff --git a/gcc/cse.c b/gcc/cse.c
index 1efcf308ae4..713b842dcc0 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3462,6 +3462,9 @@ fold_rtx_mem (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)
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 1692033e491..6de76e288f3 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1542,6 +1542,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 x);
extern bool mode_signbit_p (enum machine_mode, rtx);
/* In regclass.c */
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 13e90e99bfd..d3ec956c1ae 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -209,6 +209,14 @@ avoid_constant_pool_reference (rtx x)
return x;
}
+
+/* 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;
+}
/* Make a unary operation by first seeing if it folds and otherwise making
the specified operation. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5602451da97..e1b8b0b21b9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-09-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/23098
+ * gcc.target/i386/pr23098.c: New test.
+
2005-09-05 Mark Mitchell <mark@codesourcery.com>
PR c++/23667
diff --git a/gcc/testsuite/gcc.target/i386/pr23098.c b/gcc/testsuite/gcc.target/i386/pr23098.c
new file mode 100644
index 00000000000..3a3fd102d13
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr23098.c
@@ -0,0 +1,24 @@
+/* PR rtl-optimization/23098 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-final { scan-assembler-not "\.LC\[0-9\]" } } */
+
+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;
+}