[Bug tree-optimization/126465] [16/17 Regression] Wrong code with IFN_COND_FMA folding on SVE since r16-6508

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126465

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tamar Christina <[email protected]>:

https://gcc.gnu.org/g:e6e3290cddbf1da000bfc6fcd2a1e5a2b2cd27fb

commit r17-2789-ge6e3290cddbf1da000bfc6fcd2a1e5a2b2cd27fb
Author: Tamar Christina <[email protected]>
Date:   Wed Jul 29 14:16:52 2026 +0100

    middle-end: fix COND_FMS foldings [PR126465]

    in r16-6508-g772b847d99d5e3 I made some typos

    1. I forgot to negate the else value
    2. one of the patterns was missing the mask.

    This fixes it. The patterns moving the COND inwards are still useful
because
    they allow FMA forwarding as most micro-architectures don't forward FMA
when
    there's a random instruction like fneg in between.

    Sorry for the mistakes. I added more tests to cover these now.

    gcc/ChangeLog:

            PR tree-optimization/126465
            * match.pd: Fix FMS patterns.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/126465
            * gcc.target/aarch64/sve/cond_fma.c: New test.
            * gcc.target/aarch64/sve/cond_fma_neg_addend.c: New test.
            * gcc.target/aarch64/sve/cond_fms.c: New test.
            * gcc.target/aarch64/sve/cond_fnma.c: New test.
            * gcc.target/aarch64/sve/cond_fnms.c: New test.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.