aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-12-15 21:10:45 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-12-15 21:10:45 +0100
commit3202dcccb9dec6a008c9f1887fd4a4c75ebc8940 (patch)
treeefca2aa0c015aa9739b165ce358816d2fd54c6e2 /gcc
parentd8c1674416836c4b4573172b541992ddd12df713 (diff)
downloadgcc-3202dcccb9dec6a008c9f1887fd4a4c75ebc8940.zip
gcc-3202dcccb9dec6a008c9f1887fd4a4c75ebc8940.tar.gz
gcc-3202dcccb9dec6a008c9f1887fd4a4c75ebc8940.tar.bz2
re PR rtl-optimization/64316 (ICE in simplify_const_unary_operation after r218503)
PR rtl-optimization/64316 * simplify-rtx.c (simplify_relational_operation_1): For (eq/ne (and x y) x) and (eq/ne (and x y) y) optimizations use CONST0_RTX instead of const0_rtx. * gcc.dg/pr64316.c: New test. From-SVN: r218762
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/simplify-rtx.c6
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.dg/pr64316.c42
4 files changed, 56 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 87ee0f9..07aa48c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/64316
+ * simplify-rtx.c (simplify_relational_operation_1): For
+ (eq/ne (and x y) x) and (eq/ne (and x y) y) optimizations use
+ CONST0_RTX instead of const0_rtx.
+
2014-12-15 Vladimir Makarov <vmakarov@redhat.com>
PR target/62642
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 8ec416e..277288a 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -4561,7 +4561,8 @@ simplify_relational_operation_1 (enum rtx_code code, machine_mode mode,
rtx not_y = simplify_gen_unary (NOT, cmp_mode, XEXP (op0, 1), cmp_mode);
rtx lhs = simplify_gen_binary (AND, cmp_mode, not_y, XEXP (op0, 0));
- return simplify_gen_relational (code, mode, cmp_mode, lhs, const0_rtx);
+ return simplify_gen_relational (code, mode, cmp_mode, lhs,
+ CONST0_RTX (cmp_mode));
}
/* Likewise for (eq/ne (and x y) y). */
@@ -4573,7 +4574,8 @@ simplify_relational_operation_1 (enum rtx_code code, machine_mode mode,
rtx not_x = simplify_gen_unary (NOT, cmp_mode, XEXP (op0, 0), cmp_mode);
rtx lhs = simplify_gen_binary (AND, cmp_mode, not_x, XEXP (op0, 1));
- return simplify_gen_relational (code, mode, cmp_mode, lhs, const0_rtx);
+ return simplify_gen_relational (code, mode, cmp_mode, lhs,
+ CONST0_RTX (cmp_mode));
}
/* (eq/ne (bswap x) C1) simplifies to (eq/ne x C2) with C2 swapped. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cdf9ddc..2299c78 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2014-12-15 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/64316
+ * gcc.dg/pr64316.c: New test.
+
PR rtl-optimization/63804
* gcc.dg/pr63804.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr64316.c b/gcc/testsuite/gcc.dg/pr64316.c
new file mode 100644
index 0000000..f478aa6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64316.c
@@ -0,0 +1,42 @@
+/* PR rtl-optimization/64316 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-additional-options "-mavx2" { target { i?86-*-* x86_64-*-* } } } */
+
+struct S
+{
+ unsigned int s;
+ unsigned long w[];
+};
+
+struct S **s;
+
+int
+foo (struct S *x, struct S *y, struct S *z)
+{
+ unsigned int i;
+ unsigned long *a, *b, *c;
+ int r = 0;
+ for (a = x->w, b = y->w, c = z->w, i = 0; i < x->s; i++, a++)
+ {
+ unsigned long d = *b++ & *c++;
+ if (*a != d)
+ {
+ r = 1;
+ *a = d;
+ }
+ }
+ return r;
+}
+
+void
+bar (int x)
+{
+ int p = x - 1;
+ do
+ {
+ foo (s[x], s[x], s[p]);
+ p--;
+ }
+ while (p > 0);
+}