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

            Bug ID: 121415
           Summary: aarch64: Failure to handle PSTATE.SM & ZA for tlsdesc
                    calls
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: aarch64-sme, wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rsandifo at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64*-*-*

For:

extern __thread int x;
int f() __arm_streaming_compatible { return x; }

compiled with -O2 -fPIC, we get:

f:
.LFB0:
        .cfi_startproc
        stp     x29, x30, [sp, -16]!
        .cfi_def_cfa_offset 16
        .cfi_offset 29, -16
        .cfi_offset 30, -8
        mov     x29, sp
        adrp    x0, :tlsdesc:x
        ldr     x1, [x0, #:tlsdesc_lo12:x]
        add     x0, x0, :tlsdesc_lo12:x
        .tlsdesccall    x
        blr     x1
        mrs     x1, tpidr_el0
        ldp     x29, x30, [sp], 16
        .cfi_restore 30
        .cfi_restore 29
        .cfi_def_cfa_offset 0
        ldr     w0, [x1, x0]
        ret
        .cfi_endproc

which fails to force non-streaming mode around the call.  A function with ZA or
ZT0 state would also need to handle that.

Thanks to Wilco for the spot.

Reply via email to