diff options
author | Marek Polacek <polacek@redhat.com> | 2015-06-30 09:02:00 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2015-06-30 09:02:00 +0000 |
commit | a4398a300ed00d842f9786d529a7a4b0fce6e634 (patch) | |
tree | 58346bd90053e6a614e0e37ed3fed21fc9b01ece /gcc/match.pd | |
parent | 582554e3bc1509b6ddc407004f97e3f756bcedf5 (diff) | |
download | gcc-a4398a300ed00d842f9786d529a7a4b0fce6e634.zip gcc-a4398a300ed00d842f9786d529a7a4b0fce6e634.tar.gz gcc-a4398a300ed00d842f9786d529a7a4b0fce6e634.tar.bz2 |
fold-const.c (fold_binary_loc): Move ~X | X folding ...
* fold-const.c (fold_binary_loc): Move ~X | X folding ...
* match.pd: ... here.
* gcc.dg/fold-ior-2.c: New test.
From-SVN: r225164
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 0cf3d21..5dcbc1a 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -283,6 +283,12 @@ along with GCC; see the file COPYING3. If not see (bit_and @0 integer_zerop@1) @1) +/* ~x | x -> -1 */ +(simplify + (bit_ior:c (convert? @0) (convert? (bit_not @0))) + (if (tree_nop_conversion_p (type, TREE_TYPE (@0))) + { build_all_ones_cst (type); })) + /* x ^ x -> 0 */ (simplify (bit_xor @0 @0) |