Fix PR94880: Failure to recognize andn pattern
authorPrzemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>
Fri, 19 Jun 2020 15:48:55 +0000 (16:48 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Fri, 19 Jun 2020 15:48:55 +0000 (16:48 +0100)
commite0bfe016712ace877dd5b057bc1eb06e3c307623
tree8b88b3db0c03f40ec236100ea1feee7fcf8fc060
parent6d8b2ee568bd17a398781d86aab140b8121aad30
Fix PR94880: Failure to recognize andn pattern

Pattern "(x | y) - y" can be optimized to simple "(x & ~y)" andn
pattern.

Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/ChangeLog:

PR tree-optimization/94880
* match.pd (A | B) - B -> (A & ~B): New simplification.

gcc/testsuite/ChangeLog:

PR tree-optimization/94880
* gcc.dg/tree-ssa/pr94880.c: New Test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/pr94880.c [new file with mode: 0644]