aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr71428.c20
-rw-r--r--gcc/tree-ssa-math-opts.c6
4 files changed, 35 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 878ee3a..16e41e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2016-06-07 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/71428
+ * tree-ssa-math-opts.c (perform_symbolic_merge): Properly distinguish
+ BIT_FIELD_REF op vs. load.
+
+2016-06-07 Richard Biener <rguenther@suse.de>
+
PR middle-end/71423
* match.pd ((X | ~Y) -> Y <= X): Properly invert the comparison
for signed ops.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 52bb629..d7d651c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2016-06-07 Richard Biener <rguenther@suse.de>
+ PR tree-optimization/71428
+ * gcc.dg/torture/pr71428.c: New testcase.
+
+2016-06-07 Richard Biener <rguenther@suse.de>
+
PR middle-end/71423
* gcc.dg/torture/pr71423.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/torture/pr71428.c b/gcc/testsuite/gcc.dg/torture/pr71428.c
new file mode 100644
index 0000000..b951fcd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr71428.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+/* { dg-additional-options "-fno-tree-forwprop -Wno-psabi -w" } */
+
+typedef unsigned short v64u16 __attribute__ ((vector_size (64)));
+
+v64u16
+foo (v64u16 p1)
+{
+ p1[31] |= p1[1];
+ return p1;
+}
+
+int
+main ()
+{
+ v64u16 x = foo ((v64u16){ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 });
+ if (x[31] != 1)
+ __builtin_abort();
+ return 0;
+}
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 0b0c866..513ef0b 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -2164,10 +2164,12 @@ perform_symbolic_merge (gimple *source_stmt1, struct symbolic_number *n1,
struct symbolic_number *n_start;
tree rhs1 = gimple_assign_rhs1 (source_stmt1);
- if (TREE_CODE (rhs1) == BIT_FIELD_REF)
+ if (TREE_CODE (rhs1) == BIT_FIELD_REF
+ && TREE_CODE (TREE_OPERAND (rhs1, 0)) == SSA_NAME)
rhs1 = TREE_OPERAND (rhs1, 0);
tree rhs2 = gimple_assign_rhs1 (source_stmt2);
- if (TREE_CODE (rhs2) == BIT_FIELD_REF)
+ if (TREE_CODE (rhs2) == BIT_FIELD_REF
+ && TREE_CODE (TREE_OPERAND (rhs2, 0)) == SSA_NAME)
rhs2 = TREE_OPERAND (rhs2, 0);
/* Sources are different, cancel bswap if they are not memory location with