aboutsummaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
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 cf0bb3a..d9f35e9 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1456,6 +1456,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
&& wi::bit_and_not (get_nonzero_bits (@0), wi::to_wide (@1)) == 0)
@0))
+/* x | C -> C if we know that x & ~C == 0. */
+(simplify
+ (bit_ior SSA_NAME@0 INTEGER_CST@1)
+ (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
+ && wi::bit_and_not (get_nonzero_bits (@0), wi::to_wide (@1)) == 0)
+ @1))
#endif
/* ~(~X - Y) -> X + Y and ~(~X + Y) -> X - Y. */