2015-11-09 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Nov 2015 14:47:09 +0000 (14:47 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Nov 2015 14:47:09 +0000 (14:47 +0000)
PR tree-optimization/68248
* tree-vect-generic.c (expand_vector_operations_1): Handle
scalar rhs2.

* gcc.dg/torture/pr68248.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230021 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr68248.c [new file with mode: 0644]
gcc/tree-vect-generic.c

index 56c609f..e7d7c4b 100644 (file)
@@ -1,5 +1,11 @@
 2015-11-09  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/68248
+       * tree-vect-generic.c (expand_vector_operations_1): Handle
+       scalar rhs2.
+
+2015-11-09  Richard Biener  <rguenther@suse.de>
+
        PR tree-optimization/56118
        * tree-vectorizer.h (vect_find_last_scalar_stmt_in_slp): Declare.
        * tree-vect-slp.c (vect_find_last_scalar_stmt_in_slp): Export.
index 3809a72..d64a0a2 100644 (file)
@@ -1,5 +1,10 @@
 2015-11-09  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/68248
+       * gcc.dg/torture/pr68248.c: New testcase.
+
+2015-11-09  Richard Biener  <rguenther@suse.de>
+
        PR tree-optimization/56118
        * gcc.dg/vect/no-tree-sra-bb-slp-pr50730.c: Adjust.
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr68248.c b/gcc/testsuite/gcc.dg/torture/pr68248.c
new file mode 100644 (file)
index 0000000..0e8ab49
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+int a, b, c, d;
+
+int
+fn1 (int p1)
+{
+  return a > 0 ? p1 : p1 >> a;
+}
+
+void
+fn2 ()
+{
+  char e;
+  for (; c; c++)
+    {
+      e = fn1 (!d ^ 2);
+      b ^= e;
+    }
+}
index c64fdc4..f82b669 100644 (file)
@@ -1527,6 +1527,8 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
   tree srhs1, srhs2 = NULL_TREE;
   if ((srhs1 = ssa_uniform_vector_p (rhs1)) != NULL_TREE
       && (rhs2 == NULL_TREE
+         || (! VECTOR_TYPE_P (TREE_TYPE (rhs2))
+             && (srhs2 = rhs2))
          || (srhs2 = ssa_uniform_vector_p (rhs2)) != NULL_TREE)
       /* As we query direct optabs restrict to non-convert operations.  */
       && TYPE_MODE (TREE_TYPE (type)) == TYPE_MODE (TREE_TYPE (srhs1)))