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

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

https://gcc.gnu.org/g:732087f6a8cd21cfd81a7ce9bfad257dfef0c72d

commit r17-7062-g732087f6a8cd21cfd81a7ce9bfad257dfef0c72d
Author: Torbjörn SVENSSON <[email protected]>
Date:   Sun Nov 1 15:46:03 2026 +0100

    arm: Allow unconditional noce sequences on armv8.1-m [PR122965]

    The Armv8.1-M profitability hook rejects sequences other than the
    recognized conditional arithmetic and VSEL patterns, even when the
    conversion has removed the conditional entirely.

    There is no need to reject a sequence once the conditional is gone,
    so use the usual profitability checks in that case. Leave the
    PR116444 restriction in place when IF_THEN_ELSE remains.

    For armv8.1-m.main, the generated code for gcc.target/arm/epilog-1.c
    changes from

            push    {r3, r4, r5, lr}
            ldr     r4, .L5
            ldr     r5, [r4]
            tst     r5, #4
            csinc   r2, r2, r2, eq
            bl      bar
            movs    r0, #0
            pop     {r3, r4, r5, pc}

    to

            push    {r4, lr}
            ldr     r4, .L5
            ldr     r4, [r4]
            ubfx    r4, r4, #2, #1
            add     r2, r2, r4
            bl      bar
            movs    r0, #0
            pop     {r4, pc}

            PR target/122965

    gcc/ChangeLog:

            * config/arm/arm.cc (arm_noce_conversion_profitable_p): Use
            default profitability checks for unconditional sequences.

    gcc/testsuite/ChangeLog:

            * gcc.target/arm/epilog-1.c: Expect UBFX and ADD for
            armv8.1-m.main.

    Signed-off-by: Torbjörn SVENSSON <[email protected]>

Reply via email to