[Bug middle-end/121925] Idiom recognize FCMLA operations independently

tnfchris at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 30 08:42:05 GMT 2026


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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Target Milestone|---                         |17.0
           Assignee|unassigned at gcc dot gnu.org      |tnfchris at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2026-03-30

--- Comment #5 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
This now works, so mine for stage 1.

void f (float *restrict a, float *restrict b,
        float *restrict c, float *restrict d, int n)
{
    for (int i = 0; i < (n & -2) / 2; i+=2)
      {
        d[i] = c[i] + (a[i] * b[i+1]);
        d[i+1] = c[i+1] + (a[i] * b[i]);
      }
}

generates:

.L4:
        ldr     q31, [x1, x4]
        ldr     q30, [x2, x4]
        ldr     q29, [x0, x4]
        fcmla   v29.4s, v31.4s, v30.4s, #0
        str     q29, [x3, x4]
        add     x4, x4, 16
        cmp     x4, x6
        bne     .L4                                                            
                                                                               
                                                                               
                                     lsl     w4, w5, 1
.L3:
        ubfiz   x5, x4, 3, 32
        add     x10, x1, w4, uxtw 3
        add     x9, x2, w4, uxtw 3
        add     x8, x0, w4, uxtw 3
        add     x6, x3, w4, uxtw 3
        ldr     d28, [x1, x5]
        ldr     d27, [x2, x5]
        ldr     s26, [x0, x5]
        fcmla   v26.2s, v28.2s, v27.2s, #0
        str     d26, [x3, x5]
        cmp     w7, w4
        beq     .L1                                                            
                                                                               
                                                                               
                                     ldr     d24, [x9, 8]
        ldr     d25, [x10, 8]
        ldr     s23, [x8, 8]
        fcmla   v23.2s, v25.2s, v24.2s, #0
        str     d23, [x6, 8]
.L1:
        ret

which also ended up BB SLP'ing the epilogue and scalar fallback


More information about the Gcc-bugs mailing list