diff mbox

[i386] : Fix PR50464, ICE with blendv insn

Message ID CAFULd4b=CxcdDzVGHfMhAiTR2evuqYsiuKYYD2LK4OL_yxuSqA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Sept. 22, 2011, 5:37 p.m. UTC
Hello!

2011-09-22  Uros Bizjak  <ubizjak@gmail.com>

	PR target/50482
	* config/i386/i386.c (ix86_expand_sse_movcc): When generating
	blendv, force op_true to register if it doesn't satisfy
	nonimmediate_operand predicate.

testsuite/ChangeLog:

2011-09-22  Uros Bizjak  <ubizjak@gmail.com>

	PR target/50482
	* gcc.target/i386/pr50482.c: New test.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.
diff mbox

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 179091)
+++ config/i386/i386.c	(working copy)
@@ -18911,6 +18911,9 @@  ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_t
     {
       rtx (*gen) (rtx, rtx, rtx, rtx) = NULL;
 
+      if (!nonimmediate_operand (op_true, mode))
+	op_true = force_reg (mode, op_true);
+
       op_false = force_reg (mode, op_false);
 
       switch (mode)
Index: testsuite/gcc.target/i386/pr50482.c
===================================================================
--- testsuite/gcc.target/i386/pr50482.c	(revision 0)
+++ testsuite/gcc.target/i386/pr50482.c	(revision 0)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3 -msse4" } */
+
+void
+test (int code, unsigned int * image, int * colors)
+{
+  int i;
+
+  for (i = 0; i < code; ++i)
+    image[i] = (colors[i] < 0 ? ~(unsigned int) 0 : colors[i]);
+}