[Bug tree-optimization/100864] (a&!b) | b is not opimized to a | b for comparisons
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 31 17:12:33 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100864
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:b9237226fdc9387bccf584a811b30c5d3689ffd2
commit r14-2885-gb9237226fdc9387bccf584a811b30c5d3689ffd2
Author: Andrew Pinski <apinski@marvell.com>
Date: Fri Jul 28 20:27:03 2023 -0700
tree-optimization: [PR100864] `(a&!b) | b` is not opimized to `a | b` for
comparisons
This is a new version of the patch.
Instead of doing the matching of inversion comparison directly inside
match, creating a new function (bitwise_inverted_equal_p) to do it.
It is very similar to bitwise_equal_p that was added in
r14-2751-g2a3556376c69a1fb
but instead it says `expr1 == ~expr2`. A follow on patch, will
use this function in other patterns where we try to match `@0` and
`(bit_not @0)`.
Changed the name bitwise_not_equal_p to bitwise_inverted_equal_p.
Committed as approved after a Bootstrapped and test on x86_64-linux-gnu
with no regressions.
PR tree-optimization/100864
gcc/ChangeLog:
* generic-match-head.cc (bitwise_inverted_equal_p): New function.
* gimple-match-head.cc (bitwise_inverted_equal_p): New macro.
(gimple_bitwise_inverted_equal_p): New function.
* match.pd ((~x | y) & x): Use bitwise_inverted_equal_p
instead of direct matching bit_not.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/bitops-3.c: New test.
More information about the Gcc-bugs
mailing list