diff options
author | Eugene Rozenfeld <Eugene.Rozenfeld@microsoft.com> | 2020-11-18 14:29:49 -0500 |
---|---|---|
committer | Jeff Law <law@torsion.usersys.redhat.com> | 2020-11-18 14:31:09 -0500 |
commit | f44e6091627372bd8fc4e72874a003643b021dca (patch) | |
tree | ba824d4875ec55b119cf10c92d286d1bb55b6ef2 /gcc | |
parent | 6fae7eda968db658c280ad6f94fe6906a15af0c9 (diff) | |
download | gcc-f44e6091627372bd8fc4e72874a003643b021dca.zip gcc-f44e6091627372bd8fc4e72874a003643b021dca.tar.gz gcc-f44e6091627372bd8fc4e72874a003643b021dca.tar.bz2 |
Optimize two patterns with three xors
gcc/
PR tree-optimization/96671
* match.pd (three xor patterns): New patterns.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/match.pd | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index 349eab6..1dd05c4 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -901,6 +901,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (bit_not (bit_ior:cs (bit_not @0) @1)) (bit_and @0 (bit_not @1))) +/* (a ^ b) & ((b ^ c) ^ a) --> (a ^ b) & ~c */ +(simplify + (bit_and:c (bit_xor:c@3 @0 @1) (bit_xor:cs (bit_xor:cs @1 @2) @0)) + (bit_and @3 (bit_not @2))) + +/* (a ^ b) | ((b ^ c) ^ a) --> (a ^ b) | c */ +(simplify + (bit_ior:c (bit_xor:c@3 @0 @1) (bit_xor:c (bit_xor:c @1 @2) @0)) + (bit_ior @3 @2)) + /* Simplify (~X & Y) to X ^ Y if we know that (X & ~Y) is 0. */ #if GIMPLE (simplify |