tree-vect-transform.c (vect_get_vec_defs_for_stmt_copy): check if the VEC is not...
authorDorit Nuzman <dorit@il.ibm.com>
Sat, 15 Sep 2007 18:24:23 +0000 (18:24 +0000)
committerDorit Nuzman <dorit@gcc.gnu.org>
Sat, 15 Sep 2007 18:24:23 +0000 (18:24 +0000)
        * tree-vect-transform.c (vect_get_vec_defs_for_stmt_copy): check if
        the VEC is not NULL.
        (vectorizable_type_demotion, vectorizable_type_promotion): Check that
        get_vectype_for_scalar_type succeeded.
        (vectorizable_conversion): Likewise.

From-SVN: r128514

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr33373b.c [new file with mode: 0644]
gcc/tree-vect-transform.c

index 991f078c80359a2539feee31d054ae01f619286f..71a8ad96d63b9b58f17217fb4b35554032f0b7a6 100644 (file)
@@ -1,3 +1,11 @@
+2007-09-15  Dorit Nuzman  <dorit@il.ibm.com>
+
+       * tree-vect-transform.c (vect_get_vec_defs_for_stmt_copy): check if 
+       the VEC is not NULL.
+       (vectorizable_type_demotion, vectorizable_type_promotion): Check that 
+       get_vectype_for_scalar_type succeeded.
+       (vectorizable_conversion): Likewise.
+
 2007-09-14  Jan Hubicka  <jh@suse.cz>
 
        * config/i386/i386.md (*floatdi<mode>2_i387): Guard against
index 884f3f93984f2877ca54f2f5756a30e3629b3c27..073027f0ecf0d740d64b92e3c50c1a2df29461a3 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-15  Dorit Nuzman  <dorit@il.ibm.com>
+
+       * gcc.dg/vect/pr33373b.c: New test.
+
 2007-09-14  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/33438
diff --git a/gcc/testsuite/gcc.dg/vect/pr33373b.c b/gcc/testsuite/gcc.dg/vect/pr33373b.c
new file mode 100644 (file)
index 0000000..c294a38
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+void f (unsigned int *d, unsigned int *s, int w)
+{
+  int i;
+  for (i = 0; i < w; ++i)
+    d [i] = s [i] * (unsigned short) (~d [i] >> 24);
+}
+/* { dg-final { cleanup-tree-dump "vect" } } */
index 5331fcd763aa09bd62eeaa426d5cb533ddd1d839..df4bd08f4cd1005bc81b1691d0b4550953767ece 100644 (file)
@@ -1938,7 +1938,7 @@ vect_get_vec_defs_for_stmt_copy (enum vect_def_type *dt,
   vec_oprnd = vect_get_vec_def_for_stmt_copy (dt[0], vec_oprnd);
   VEC_quick_push (tree, *vec_oprnds0, vec_oprnd);
 
-  if (vec_oprnds1)
+  if (vec_oprnds1 && *vec_oprnds1)
     {
       vec_oprnd = VEC_pop (tree, *vec_oprnds1);
       vec_oprnd = vect_get_vec_def_for_stmt_copy (dt[1], vec_oprnd);
@@ -3309,11 +3309,15 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
   op0 = TREE_OPERAND (operation, 0);
   rhs_type = TREE_TYPE (op0);
   vectype_in = get_vectype_for_scalar_type (rhs_type);
+  if (!vectype_in)
+    return false;
   nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
 
   scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
   lhs_type = TREE_TYPE (scalar_dest);
   vectype_out = get_vectype_for_scalar_type (lhs_type);
+  if (!vectype_out)
+    return false;
   nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
 
   /* FORNOW */
@@ -4083,10 +4087,14 @@ vectorizable_type_demotion (tree stmt, block_stmt_iterator *bsi,
 
   op0 = TREE_OPERAND (operation, 0);
   vectype_in = get_vectype_for_scalar_type (TREE_TYPE (op0));
+  if (!vectype_in)
+    return false;
   nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
 
   scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
   vectype_out = get_vectype_for_scalar_type (TREE_TYPE (scalar_dest));
+  if (!vectype_out)
+    return false;
   nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
   if (nunits_in != nunits_out / 2) /* FORNOW */
     return false;
@@ -4241,10 +4249,14 @@ vectorizable_type_promotion (tree stmt, block_stmt_iterator *bsi,
 
   op0 = TREE_OPERAND (operation, 0);
   vectype_in = get_vectype_for_scalar_type (TREE_TYPE (op0));
+  if (!vectype_in)
+    return false;
   nunits_in = TYPE_VECTOR_SUBPARTS (vectype_in);
 
   scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
   vectype_out = get_vectype_for_scalar_type (TREE_TYPE (scalar_dest));
+  if (!vectype_out)
+    return false;
   nunits_out = TYPE_VECTOR_SUBPARTS (vectype_out);
   if (nunits_out != nunits_in / 2) /* FORNOW */
     return false;