This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix target/17692
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 Jul 2005 13:44:08 -0700
- Subject: fix target/17692
The comment in the testcase is instructive as to the cause.
The failure is due to me forgetting that emitting nothing in
a splitter is indistinguishable from a FAIL. If we want to
expand to nothing, we have to emit a DELETED note.
r~
* config/i386/i386.c (ix86_split_sse_movcc): Emit DELETED note
when expanding to nothing.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.795.6.9
diff -u -p -d -r1.795.6.9 i386.c
--- i386.c 9 Jul 2005 08:49:51 -0000 1.795.6.9
+++ i386.c 28 Jul 2005 17:48:09 -0000
@@ -10133,6 +10133,7 @@ ix86_split_sse_movcc (rtx operands[])
conditional move to a straight move. Do so here, because
otherwise we'll generate incorrect code. And since they're
both already in the destination register, nothing to do. */
+ emit_note (NOTE_INSN_DELETED);
return;
}
Index: testsuite/gcc.target/i386/pr17692.c
===================================================================
RCS file: testsuite/gcc.target/i386/pr17692.c
diff -N testsuite/gcc.target/i386/pr17692.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.target/i386/pr17692.c 28 Jul 2005 20:38:50 -0000
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O -mfpmath=sse -msse2" } */
+/* The fact that t1 and t2 are uninitialized is critical. With them
+ uninitialized, the register allocator is free to put them in the same
+ hard register, which results in
+
+ xmm0 = xmm0 >= xmm0 ? xmm0 : xmm0
+
+ Which is of course a nop, but one for which we would ICE splitting the
+ pattern. */
+
+double out;
+
+static void foo(void)
+{
+ double t1, t2, t3, t4;
+
+ t4 = t1 >= t2 ? t1 : t2;
+ t4 = t4 >= t3 ? t4 : t3;
+ out = t4;
+}