aboutsummaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-06-30 09:02:00 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-06-30 09:02:00 +0000
commita4398a300ed00d842f9786d529a7a4b0fce6e634 (patch)
tree58346bd90053e6a614e0e37ed3fed21fc9b01ece /gcc/match.pd
parent582554e3bc1509b6ddc407004f97e3f756bcedf5 (diff)
downloadgcc-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.pd6
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)