summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-04 10:07:19 +0000
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-04 10:07:19 +0000
commitaa70f65eec67507a2c94b3ce2696945abd066aed (patch)
tree5e385c13788bef59e16a57f49b74a6ac9b4571b1 /gcc
parentf528f86ac146c212e22075517bd65fd58ac8f1c2 (diff)
downloadgcc-aa70f65eec67507a2c94b3ce2696945abd066aed.tar.gz
PR middle-end/33187
* combine.c (subst): Do not try to simplify X if it represents load of FP constant from the constant pool via float extension. testsuite/ChangeLog: PR middle-end/33187 * gcc.target/i386/cmov7.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128072 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/combine.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/cmov7.c15
4 files changed, 38 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 630a118ae98..e3c0ea4a826 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-04 Uros Bizjak <ubizjak@gmail.com>
+
+ PR middle-end/33187
+ * combine.c (subst): Do not try to simplify X if it represents load
+ of FP constant from the constant pool via float extension.
+
2007-09-04 Ben Elliston <bje@au.ibm.com>
* c-opts.c: Include "tm_p.h".
diff --git a/gcc/combine.c b/gcc/combine.c
index c794e11857f..b2bc7806f7b 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -4478,6 +4478,18 @@ subst (rtx x, rtx from, rtx to, int in_dest, int unique_copy)
}
}
+ /* Check if we are loading something from the constant pool via float
+ extension; in this case we would undo compress_float_constant
+ optimization and degenerate constant load to an immediate value. */
+ if (GET_CODE (x) == FLOAT_EXTEND
+ && MEM_P (XEXP (x, 0))
+ && MEM_READONLY_P (XEXP (x, 0)))
+ {
+ rtx tmp = avoid_constant_pool_reference (x);
+ if (x != tmp)
+ return x;
+ }
+
/* Try to simplify X. If the simplification changed the code, it is likely
that further simplification will help, so loop, but limit the number
of repetitions that will be performed. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 465aaa29b6f..1db7371f602 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2007-09-04 Uros Bizjak <ubizjak@gmail.com>
+ PR middle-end/33187
+ * gcc.target/i386/cmov7.c: New file.
+
+2007-09-04 Uros Bizjak <ubizjak@gmail.com>
+
* gcc.target/i386/sse4a-check.h: New file.
* gcc.target/i386/sse4a-extract.c: Include sse4a-check.h. Remove main.
* gcc.target/i386/sse4a-insert.c: Ditto.
diff --git a/gcc/testsuite/gcc.target/i386/cmov7.c b/gcc/testsuite/gcc.target/i386/cmov7.c
new file mode 100644
index 00000000000..b5d50d7cbcf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/cmov7.c
@@ -0,0 +1,15 @@
+/* PR middle-end/33187 */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=k8 -ffast-math -mfpmath=387" } */
+/* { dg-final { scan-assembler "fcmov" } } */
+
+/* compress_float_constant generates load + float_extend
+ sequence which combine pass failed to combine into
+ (set (reg:DF) (float_extend:DF (mem:SF (symbol_ref...)))). */
+
+double
+sgn (double __x)
+{
+ return __x >= 0.0 ? 1.0 : -1.0;
+}