re PR tree-optimization/51799 (Compiler ICE in vect_is_simple_use_1)
authorIra Rosen <irar@il.ibm.com>
Thu, 12 Jan 2012 14:41:44 +0000 (14:41 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Thu, 12 Jan 2012 14:41:44 +0000 (14:41 +0000)
        PR tree-optimization/51799
        * tree-vect-patterns.c (vect_recog_over_widening_pattern): Check
        that the last operation is a type demotion.

From-SVN: r183126

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr51799.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/vect/vect-widen-shift-u8.c
gcc/tree-vect-patterns.c

index 1d6a1af28ca9a95ff5c780f4b9dc9c7f215dbeb9..c0898c56d942c438a171e5eea1d146e026da5f3c 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-12  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/51799
+       * tree-vect-patterns.c (vect_recog_over_widening_pattern): Check
+       that the last operation is a type demotion.
+
 2012-01-12  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (*zero_extendsidi2_rex64): Correct movl template.
index b576b6928d42eeb893ea65a7cc1ff44b86161a75..56f28ee354b88233071d7e16706df02f7194594e 100644 (file)
@@ -1,3 +1,10 @@
+2012-01-12  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/51799
+       * gcc.dg/vect/pr51799.c: New test.
+       * gcc.dg/vect/vect-widen-shift-u8.c: Expect two widening shift
+       patterns.
+
 2012-01-12  Dominique d'Humieres  <dominiq@lps.ens.fr>
            Tobias Burnus  <burnus@net-b.de>
 
diff --git a/gcc/testsuite/gcc.dg/vect/pr51799.c b/gcc/testsuite/gcc.dg/vect/pr51799.c
new file mode 100644 (file)
index 0000000..7d95e36
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned long uint32_t;
+void
+f0a (uint32_t * __restrict__ result, int8_t * __restrict__ arg1,
+     uint32_t * __restrict__ arg4, int8_t temp_6)
+{
+  int idx;
+  for (idx = 0; idx < 416; idx += 1)
+    {
+      result[idx] = (uint8_t)(((arg1[idx] << 7) + arg4[idx]) * temp_6);
+    }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
index b87a277c2f780a87e6c76973dbdb103fa418501d..49d5a88a663e16b82819235ebde9f369387155bc 100644 (file)
@@ -59,7 +59,6 @@ int main (void)
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "vect_recog_widen_shift_pattern: detected" 1 "vect" { target vect_widen_shift } } } */
+/* { dg-final { scan-tree-dump-times "vect_recog_widen_shift_pattern: detected" 2 "vect" { target vect_widen_shift } } } */
 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */
-
index 46d43ce44add41db696db521eedb47b038396cd6..34ac2e5329f691d66dc839582eabf31806ae3861 100644 (file)
@@ -1186,13 +1186,15 @@ vect_recog_over_widening_pattern (VEC (gimple, heap) **stmts,
     {
       use_lhs = gimple_assign_lhs (use_stmt);
       use_type = TREE_TYPE (use_lhs);
-      /* Support only type promotion or signedess change.  Check that USE_TYPE
-        is not bigger than the original type.  */
+      /* Support only type demotion or signedess change.  */
       if (!INTEGRAL_TYPE_P (use_type)
-          || TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type)
-         || TYPE_PRECISION (type) < TYPE_PRECISION (use_type))
+         || TYPE_PRECISION (type) <= TYPE_PRECISION (use_type))
         return NULL;
 
+      /* Check that NEW_TYPE is not bigger than the conversion result.  */
+      if (TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type))
+       return NULL;
+
       if (TYPE_UNSIGNED (new_type) != TYPE_UNSIGNED (use_type)
           || TYPE_PRECISION (new_type) != TYPE_PRECISION (use_type))
         {