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

--- Comment #1 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:44fcc1ca11e7ea35dc9fb25a5317346bc1eaf7b2

commit r15-2106-g44fcc1ca11e7ea35dc9fb25a5317346bc1eaf7b2
Author: Eikansh Gupta <quic_eikag...@quicinc.com>
Date:   Wed May 22 23:28:48 2024 +0530

    MATCH: Simplify (a ? x : y) eq/ne (b ? x : y) [PR111150]

    This patch adds match pattern for `(a ? x : y) eq/ne (b ? x : y)`.
    In forwprop1 pass, depending on the type of `a` and `b`, GCC produces
    `vec_cond` or `cond_expr`. Based on the observation that `(x != y)` is
    TRUE, the pattern can be optimized to produce `(a^b ? TRUE : FALSE)`.

    The patch adds match pattern for a, b:
    (a ? x : y) != (b ? x : y) --> (a^b) ? TRUE  : FALSE
    (a ? x : y) == (b ? x : y) --> (a^b) ? FALSE : TRUE
    (a ? x : y) != (b ? y : x) --> (a^b) ? TRUE  : FALSE
    (a ? x : y) == (b ? y : x) --> (a^b) ? FALSE : TRUE

            PR tree-optimization/111150

    gcc/ChangeLog:

            * match.pd (`(a ? x : y) eq/ne (b ? x : y)`): New pattern.
            (`(a ? x : y) eq/ne (b ? y : x)`): New pattern.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr111150.c: New test.
            * gcc.dg/tree-ssa/pr111150-1.c: New test.
            * g++.dg/tree-ssa/pr111150.C: New test.

    Signed-off-by: Eikansh Gupta <quic_eikag...@quicinc.com>

Reply via email to