https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115449

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:0256121e2f23ac3550e87410c9b1e690c8edfc7c

commit r15-1215-g0256121e2f23ac3550e87410c9b1e690c8edfc7c
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Tue Jun 11 17:16:42 2024 -0700

    match: Improve gimple_bitwise_equal_p and gimple_bitwise_inverted_equal_p
for truncating casts [PR115449]

    As mentioned by Jeff in r15-831-g05daf617ea22e1d818295ed2d037456937e23530,
we don't handle
    `(X | Y) & ~Y` -> `X & ~Y` on the gimple level when there are some
different signed
    (but same precision) types dealing with matching `~Y` with the `Y` part.
This
    improves both gimple_bitwise_equal_p and gimple_bitwise_inverted_equal_p to
    be able to say `(truncate)a` and `(truncate)a` are bitwise_equal and
    that `~(truncate)a` and `(truncate)a` are bitwise_invert_equal.

    Bootstrapped and tested on x86_64-linux-gnu with no regressions.

            PR tree-optimization/115449

    gcc/ChangeLog:

            * gimple-match-head.cc (gimple_maybe_truncate): New declaration.
            (gimple_bitwise_equal_p): Match truncations that differ only
            in types with the same precision.
            (gimple_bitwise_inverted_equal_p): For matching after
bit_not_with_nop
            call gimple_bitwise_equal_p.
            * match.pd (maybe_truncate): New match pattern.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/bitops-10.c: New test.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Reply via email to