re PR target/23376 (ICE on GCC 4.x with -O1 -funroll-loops -fvariable-expansion-in...
authorSteven Bosscher <steven@gcc.gnu.org>
Tue, 16 Aug 2005 22:24:30 +0000 (22:24 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Tue, 16 Aug 2005 22:24:30 +0000 (22:24 +0000)
PR target/23376
* loop-unroll.c (analyze_insn_to_expand_var): Make sure that
force_operand will work later on using have_insn_for.

From-SVN: r103181

gcc/ChangeLog
gcc/fortran/ChangeLog
gcc/loop-unroll.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/x86_64/pr23376.c [new file with mode: 0644]

index 4f2689b6bf43fed0ec491d9d665f438d59445065..54cea246995d12a9bdbc72b3d275fd99eeb7cc51 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-16  Steven Bosscher  <stevenb@suse.de>
+
+       PR target/23376
+       * loop-unroll.c (analyze_insn_to_expand_var): Make sure that
+       force_operand will work later on using have_insn_for.
+
 2005-08-16  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * fold-const.c (tree_expr_nonnegative_p): Regroup cases.
index 1850b3127b4dd5749b71dfb0d356873b146d0513..87f6e123dd6c888acc255d1cf3ac17c4bd06186b 100644 (file)
@@ -22,7 +22,7 @@
        * trans-stmt.c (gfc_trans_arithmetic_if): Optimized in case of equal
        labels.
 
-2005-09-11  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+2005-08-11  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
            Steven Bosscher  <stevenb@suse.de>
 
        PR libfortran/20006
index 8293448f5cff7ed77be9c19ed5dc8db1ed7bb1ce..4cabfd58504911d184e50164aab7bda5131eb1cf 100644 (file)
@@ -1574,7 +1574,19 @@ analyze_insn_to_expand_var (struct loop *loop, rtx insn)
       && GET_CODE (src) != MINUS
       && GET_CODE (src) != MULT)
     return NULL;
-  
+
+  /* Hmm, this is a bit paradoxical.  We know that INSN is a valid insn
+     in MD.  But if there is no optab to generate the insn, we can not
+     perform the variable expansion.  This can happen if an MD provides
+     an insn but not a named pattern to generate it, for example to avoid
+     producing code that needs additional mode switches like for x87/mmx.
+
+     So we check have_insn_for which looks for an optab for the operation
+     in SRC.  If it doesn't exist, we can't perform the expansion even
+     though INSN is valid.  */
+  if (!have_insn_for (GET_CODE (src), GET_MODE (src)))
+    return NULL;
+
   if (!XEXP (src, 0))
     return NULL;
   
index 043d4c7e1e2ec2282490ca0b3f82db0749ab94de..96be244e0c204091aa0428c0034d230fadc54294 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-16  Steven Bosscher  <stevenb@suse.de>
+
+       PR target/23376
+       * gcc.target/x86_64/pr23376.c: New test.
+
 2005-08-16  Ian Lance Taylor  <ian@airs.com>
 
        PR c++/23337
diff --git a/gcc/testsuite/gcc.target/x86_64/pr23376.c b/gcc/testsuite/gcc.target/x86_64/pr23376.c
new file mode 100644 (file)
index 0000000..ba60399
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -funroll-loops -fvariable-expansion-in-unroller" } */
+
+typedef int __m64 __attribute__ ((__vector_size__ (8)));
+typedef int __v2si __attribute__ ((__vector_size__ (8)));
+
+static __inline __m64 __attribute__((__always_inline__))
+_mm_add_pi32 (__m64 __m1, __m64 __m2)
+{
+  return (__m64) __builtin_ia32_paddd ((__v2si)__m1, (__v2si)__m2);
+}
+
+__m64
+simple_block_diff_up_mmx_4 (const int width, __m64 ref1)
+{
+  __m64 sum;
+  int count = width >>1;
+  while (count--)
+    sum = _mm_add_pi32 (sum, ref1);
+  return sum;
+}