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

            Bug ID: 127653
           Summary: arm: Invalid offset for bf16 load/store
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rearnsha at gcc dot gnu.org
  Target Milestone: ---

Compiling the following with -marm -O0, generates invalid assembly.  The offset
for the strh exceeds the range +/-255.

void sink(void *);
void f(__bf16 *p) {
    char pad[300];
    __bf16 x = *p;
    sink(pad);
    sink(&x);
}

Generates:

        push    {fp, lr}
        add     fp, sp, #4
        sub     sp, sp, #312
        str     r0, [fp, #-312]
        ldr     r3, [fp, #-312]
        ldrh    r3, [r3]        @ __bf16
        strh    r3, [fp, #-306] @ __bf16.  <- Invalid immediate offset
        sub     r3, fp, #304
        mov     r0, r3
        bl      sink
...

Wrong code, but has probably been like this for years.

Reply via email to