From: Eugene Rozenfeld Date: Mon, 30 Nov 2020 16:48:58 +0000 (-0700) Subject: Optimize or+and+or pattern to and+or X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28a7fdd81e857057f18f87a3c9dd180ad99b77f6;p=gcc.git Optimize or+and+or pattern to and+or gcc/ PR tree-optimization/96679 * match.pd (((b | c) & a) | b -> (a & c) | b): New pattern. --- diff --git a/gcc/match.pd b/gcc/match.pd index 1726c186daa..6cf16c67009 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1460,6 +1460,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (bitop:c (rbitop:c (bit_not @0) @1) @0) (bitop @0 @1))) +/* ((x | y) & z) | x -> (z & y) | x */ +(simplify + (bit_ior:c (bit_and:cs (bit_ior:cs @0 @1) @2) @0) + (bit_ior (bit_and @2 @1) @0)) + /* (x | CST1) & CST2 -> (x & CST2) | (CST1 & CST2) */ (simplify (bit_and (bit_ior @0 CONSTANT_CLASS_P@1) CONSTANT_CLASS_P@2)