diff options
author | Richard Biener <rguenther@suse.de> | 2014-12-01 13:08:10 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-12-01 13:08:10 +0000 |
commit | e19740aef3f3c7c07c67e59560ef96e31e9bff96 (patch) | |
tree | c3503f339e15ee5b38b97e471ef1351b57ae324d /gcc/match.pd | |
parent | 9df0192130fd054a9edf84884ca7bbccf8f7679a (diff) | |
download | gcc-e19740aef3f3c7c07c67e59560ef96e31e9bff96.zip gcc-e19740aef3f3c7c07c67e59560ef96e31e9bff96.tar.gz gcc-e19740aef3f3c7c07c67e59560ef96e31e9bff96.tar.bz2 |
re PR tree-optimization/64126 (FAIL: gcc.dg/pr37289.c scan-tree-dump original "-\\(long unsigned int\\) x")
2014-12-01 Richard Biener <rguenther@suse.de>
PR middle-end/64126
* match.pd: Allow conversions in ~A + 1 -> -A, add -A - 1 -> ~A
and -1 - A -> ~A.
* fold-const.c (fold_binary_loc): Remove transforms here.
From-SVN: r218210
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 01f610c..42e7c62 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -484,8 +484,22 @@ along with GCC; see the file COPYING3. If not see /* ~A + 1 -> -A */ (simplify - (plus (bit_not @0) integer_each_onep) - (negate @0)) + (plus (convert? (bit_not @0)) integer_each_onep) + (if (tree_nop_conversion_p (type, TREE_TYPE (@0))) + (negate (convert @0)))) + + /* -A - 1 -> ~A */ + (simplify + (minus (convert? (negate @0)) integer_each_onep) + (if (!TYPE_OVERFLOW_TRAPS (type) + && tree_nop_conversion_p (type, TREE_TYPE (@0))) + (bit_not (convert @0)))) + + /* -1 - A -> ~A */ + (simplify + (minus integer_all_onesp @0) + (if (TREE_CODE (type) != COMPLEX_TYPE) + (bit_not @0))) /* (T)(P + A) - (T)P -> (T) A */ (for add (plus pointer_plus) |