From 28a7fdd81e857057f18f87a3c9dd180ad99b77f6 Mon Sep 17 00:00:00 2001 From: Eugene Rozenfeld Date: Mon, 30 Nov 2020 09:48:58 -0700 Subject: [PATCH] Optimize or+and+or pattern to and+or gcc/ PR tree-optimization/96679 * match.pd (((b | c) & a) | b -> (a & c) | b): New pattern. --- gcc/match.pd | 5 +++++ 1 file changed, 5 insertions(+) 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)