aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2015-07-06 08:43:58 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-07-06 08:43:58 +0000
commitc8ba649886633947106b28f1ebf43b3b0d86be6c (patch)
tree3e27070b49bb39532fbd3c286b5b62b54ba5e09d
parent43cbef95550f95ff267e306f7c9c970323781ef5 (diff)
downloadgcc-c8ba649886633947106b28f1ebf43b3b0d86be6c.zip
gcc-c8ba649886633947106b28f1ebf43b3b0d86be6c.tar.gz
gcc-c8ba649886633947106b28f1ebf43b3b0d86be6c.tar.bz2
re PR tree-optimization/66757 (wrong code at -O1 and above on x86_64-linux-gnu)
PR tree-optimization/66757 * match.pd: Add missing condition to ~X ^ C -> X ^ ~C. From-SVN: r225446
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/match.pd3
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr66757.c15
4 files changed, 27 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0d6337c..234468c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR tree-optimization/66757
+ * match.pd: Add missing condition to ~X ^ C -> X ^ ~C.
+
2015-07-05 Chung-Lin Tang <cltang@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com>
diff --git a/gcc/match.pd b/gcc/match.pd
index 7d1d4df..ae0d9f1 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -444,7 +444,8 @@ along with GCC; see the file COPYING3. If not see
/* Convert ~X ^ C to X ^ ~C. */
(simplify
(bit_xor (convert? (bit_not @0)) INTEGER_CST@1)
- (bit_xor (convert @0) (bit_not @1)))
+ (if (tree_nop_conversion_p (type, TREE_TYPE (@0)))
+ (bit_xor (convert @0) (bit_not @1))))
/* Fold (X & Y) ^ Y as ~X & Y. */
(simplify
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e1f30e4..da05a94 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,8 +1,11 @@
+2015-07-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/pr66757.c: New test.
+
2015-07-06 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/66720
- * gcc.dg/vect/pr48052.c: Use dg-require-effective-target
- vect_int_mult.
+ * gcc.dg/vect/pr48052.c: Use dg-require-effective-target vect_int_mult.
2015-07-05 Chung-Lin Tang <cltang@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com>
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr66757.c b/gcc/testsuite/gcc.c-torture/execute/pr66757.c
new file mode 100644
index 0000000..acd4d20
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr66757.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/66757 */
+/* Testcase by Zhendong Su <su@cs.ucdavis.edu> */
+
+int a, b;
+
+int
+main (void)
+{
+ unsigned int t = (unsigned char) (~b);
+
+ if ((t ^ 1) / 255)
+ __builtin_abort ();
+
+ return 0;
+}