On 11/6/26 3:15 PM, Daniel Barboza wrote:
During the review of the first PR115547 patterns [1] Jeff mentioned that
this zero_one pattern:

(X ^ Y) & (Z | X | Y) -> X ^ Y

can be also applied for non-zero_one values.  He's correct.  In the
original patch this pattern was mixed with the NE variant, which is
zero_one restricted, and we ended up missing out on this one.

Split the existing (X NE|BIT_XOR Y) pattern in two: one (X ^ Y) pattern
for all values and another (X NE Y) pattern that is zero_one restricted.

Bootstrapped and regression tested in x86_64.

[1] https://gcc.gnu.org/pipermail/gcc-patches/2026-November/737058.html

gcc/ChangeLog:

        * match.pd(`(X ^ Y) & (Z | X | Y)`): New pattern.
        (`(X NE Y) & (Z | X | Y)`): New pattern.

gcc/testsuite/ChangeLog:

        * gcc.dg/tree-ssa/pr115547.c: add "(X ^ Y) & (Z | X | Y)"
        non-zero_one testcases.
LGTM and Sashiko clean.  OK for the trunk.

jeff

Reply via email to