Hi,

In PR71478, for vector negation of ssa produced by call stmt, we add vector (-1) and ssa to the ops list. However, in the place where we remove the (-1) from ops list, we failed to do this for vector integer. As a result, rewrite_expr_tree wrongly assumes that it is working with gimple_assign.

Attached patch fixes the place where we remove the vector (-1).

Regression tested on x86-64-linux-gnu with no new regressions. Regression testing on aarc64-linux-gnu is ongoing. Is this OK for trunk?

Thanks,
Kugan

gcc/testsuite/ChangeLog:

2016-06-10  Kugan Vivekanandarajah  <kug...@linaro.org>

        * gcc.dg/pr71478.c: New test.

gcc/ChangeLog:

2016-06-10  Kugan Vivekanandarajah  <kug...@linaro.org>

        * tree-ssa-reassoc.c (reassociate_bb): Remove (-1) from ops list for
        vector integer type.
diff --git a/gcc/testsuite/gcc.dg/pr71478.c b/gcc/testsuite/gcc.dg/pr71478.c
index e69de29..7b9cce6 100644
--- a/gcc/testsuite/gcc.dg/pr71478.c
+++ b/gcc/testsuite/gcc.dg/pr71478.c
@@ -0,0 +1,21 @@
+/* PR target/71478 */
+/* { dg-require-effective-target vect_int } */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+typedef unsigned int __attribute__ ((vector_size (8))) uv2si;
+typedef int __attribute__ ((vector_size (8))) v2si;
+
+uv2si bar (v2si);
+
+uv2si
+foo (void)
+{
+  v2si x = (v2si) (0x00007fff80008000UL);
+  v2si y = (v2si) (0x8f997fff00000000UL);
+  uv2si z = x >= y;
+  uv2si k = bar (x);
+  uv2si j = k * __builtin_shuffle (z, z, (uv2si) {1, 3});
+  return k * j;
+}
+
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 36b34d3..e32d503 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -5303,8 +5303,7 @@ reassociate_bb (basic_block bb)
                  && rhs_code == MULT_EXPR)
                {
                  last = ops.last ();
-                 if (((TREE_CODE (last->op) == INTEGER_CST
-                       && integer_minus_onep (last->op))
+                 if ((integer_minus_onep (last->op)
                       || real_minus_onep (last->op))
                      && !HONOR_SNANS (TREE_TYPE (lhs))
                      && (!HONOR_SIGNED_ZEROS (TREE_TYPE (lhs))

Reply via email to