[PATCH, i386]: Fix PR57098, ICE with -mcmodel=large -msse4 and __builtin_shuffle()

Uros Bizjak ubizjak@gmail.com
Tue Apr 30 06:24:00 GMT 2013


Hello!

2013-04-29  Uros Bizjak  <ubizjak@gmail.com>

    PR target/57098
    * config/i386/i386.c (ix86_expand_vec_perm): Validize constant memory.

2013-04-29  Uros Bizjak  <ubizjak@gmail.com>

    PR target/57098
    * gcc.target/i386/pr57098.c: New test.

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

The patch will be backported to 4.7 and 4.8 branches.

Uros.
-------------- next part --------------
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 198401)
+++ config/i386/i386.c	(working copy)
@@ -20559,7 +20559,7 @@ ix86_expand_vec_perm (rtx operands[])
 	      vec[i * 2 + 1] = const1_rtx;
 	    }
 	  vt = gen_rtx_CONST_VECTOR (maskmode, gen_rtvec_v (w, vec));
-	  vt = force_const_mem (maskmode, vt);
+	  vt = validize_mem (force_const_mem (maskmode, vt));
 	  t1 = expand_simple_binop (maskmode, PLUS, t1, vt, t1, 1,
 				    OPTAB_DIRECT);
 
@@ -20756,7 +20756,7 @@ ix86_expand_vec_perm (rtx operands[])
       for (i = 0; i < 16; ++i)
 	vec[i] = GEN_INT (i/e * e);
       vt = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, vec));
-      vt = force_const_mem (V16QImode, vt);
+      vt = validize_mem (force_const_mem (V16QImode, vt));
       if (TARGET_XOP)
 	emit_insn (gen_xop_pperm (mask, mask, mask, vt));
       else
@@ -20767,7 +20767,7 @@ ix86_expand_vec_perm (rtx operands[])
       for (i = 0; i < 16; ++i)
 	vec[i] = GEN_INT (i % e);
       vt = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, vec));
-      vt = force_const_mem (V16QImode, vt);
+      vt = validize_mem (force_const_mem (V16QImode, vt));
       emit_insn (gen_addv16qi3 (mask, mask, vt));
     }
 
Index: testsuite/gcc.target/i386/pr57098.c
===================================================================
--- testsuite/gcc.target/i386/pr57098.c	(revision 0)
+++ testsuite/gcc.target/i386/pr57098.c	(working copy)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-msse4 -mcmodel=large" } */
+
+typedef int V __attribute__((vector_size(16)));
+
+void foo (V *p, V *mask)
+{
+  *p = __builtin_shuffle (*p, *mask);
+}


More information about the Gcc-patches mailing list