Hello!
Attached patch fixes corner case with -fno-dse, where the insn has all
outputs unused. Do not bother with the insn in this case and simply
delete it from splitter.
2011-08-27 Uros Bizjak <[email protected]>
PR target/50202
* config/i386/sse.md (sse4_2_pcmpestr): Emit NOTE_INSN_DELETED note
when all outputs are unused.
(sse4_2_pcmpistr): Ditto.
testsuite/ChangeLog:
2011-08-27 Uros Bizjak <[email protected]>
PR target/50202
* gcc.target/i386/pr50202.c: New test.
Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.
Committed to mainline SVN and to 4.6.
Uros.
Index: config/i386/sse.md
===================================================================
--- config/i386/sse.md (revision 178129)
+++ config/i386/sse.md (working copy)
@@ -9734,6 +9734,9 @@
operands[2], operands[3],
operands[4], operands[5],
operands[6]));
+ if (!(flags || ecx || xmm0))
+ emit_note (NOTE_INSN_DELETED);
+
DONE;
}
[(set_attr "type" "sselog")
@@ -9861,6 +9864,9 @@
emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
operands[2], operands[3],
operands[4]));
+ if (!(flags || ecx || xmm0))
+ emit_note (NOTE_INSN_DELETED);
+
DONE;
}
[(set_attr "type" "sselog")
Index: testsuite/gcc.target/i386/pr50202.c
===================================================================
--- testsuite/gcc.target/i386/pr50202.c (revision 0)
+++ testsuite/gcc.target/i386/pr50202.c (revision 0)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-dse -fno-dce -msse4" } */
+/* { dg-require-effective-target sse4 } */
+
+typedef char __v16qi __attribute__ ((__vector_size__ (16)));
+
+__v16qi v;
+int i;
+
+void
+foo (void)
+{
+ i = __builtin_ia32_pcmpistri128 (v, v, 255);
+ i = 255;
+}