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

            Bug ID: 116444
           Summary: gcc.target/arm/thumb-ifcvt-2.c fails on Cortex-M55 and
                    misses possible Cortex-M optimization
           Product: gcc
           Version: 13.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: azoff at gcc dot gnu.org
  Target Milestone: ---

Cortex-M55 does not generate optimal code for gcc.target/arm/thumb-ifcvt-2.c.

For Cortex-M3, and other Thumb2 targets, the generated code is:
foo:
        cmp     r0, r1
        ite     ne
        lslne   r0, r0, #1
        asreq   r0, r1, #1
        add     r0, r0, r1
        bx      lr

For Cortex-M55 it's instead:
foo:
        lsls    r2, r0, #1
        cmp     r0, r1
        asr     r3, r1, #1
        ite     eq
        moveq   r0, r3
        movne   r0, r2
        add     r0, r0, r1
        bx      lr

The reason why it's different comes from arm_have_conditional_execution()
returning false because "TARGET_COND_ARITH && !reload_completed" is evaluated
to true for Cortex-M55 while Cortex-M3 instead returns true.

Reply via email to