From c8ba649886633947106b28f1ebf43b3b0d86be6c Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 6 Jul 2015 08:43:58 +0000 Subject: 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 --- gcc/ChangeLog | 5 +++++ gcc/match.pd | 3 ++- gcc/testsuite/ChangeLog | 7 +++++-- gcc/testsuite/gcc.c-torture/execute/pr66757.c | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr66757.c 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 + + PR tree-optimization/66757 + * match.pd: Add missing condition to ~X ^ C -> X ^ ~C. + 2015-07-05 Chung-Lin Tang Sandra Loosemore 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 + + * gcc.c-torture/execute/pr66757.c: New test. + 2015-07-06 Bin Cheng 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 Sandra Loosemore 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 */ + +int a, b; + +int +main (void) +{ + unsigned int t = (unsigned char) (~b); + + if ((t ^ 1) / 255) + __builtin_abort (); + + return 0; +} -- cgit v1.1