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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:5e26bbfbdfa875ef464896bb8768669dd5a9ceb9

commit r17-126-g5e26bbfbdfa875ef464896bb8768669dd5a9ceb9
Author: Netanel Komm <[email protected]>
Date:   Tue Apr 28 01:59:37 2026 +0300

    match.pd: x != CST1 ? x + CST2 : CST3 -> x + CST2 [PR112659, PR122996]

    This patch extends the conditional addition simplification introduced
    in PR 122996 to handle a third constant and uniform vectors. This also
    resolves the missing vector addition fold noted in PR 112659.

    It simplifies x != CST1 ? x + CST2 : CST3 into x + CST2 when
    CST1 + CST2 == CST3.

    Bootstrapped and regression tested on x86_64-pc-linux-gnu.

            PR tree-optimization/112659
            PR tree-optimization/122996

    gcc/ChangeLog:

            * match.pd: Extend conditional addition pattern to handle
            a third constant and uniform vectors.

    gcc/testsuite/ChangeLog:

            * g++.dg/tree-ssa/cond-add-vec-1.C: New test (positive cases).
            * g++.dg/tree-ssa/cond-add-vec-2.C: New test (negative cases).
            * gcc.dg/tree-ssa/cond-add-1.c: New test (positive cases).
            * gcc.dg/tree-ssa/cond-add-2.c: New test (negative cases).

Reply via email to