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

Spencer Abson <sabson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sabson at gcc dot gnu.org

--- Comment #2 from Spencer Abson <sabson at gcc dot gnu.org> ---
Thanks for reporting this.

IIUC, this issue stems from how streaming state is switched and restored across
the boundaries of streaming-compatible and non-streaming-compatible functions,
see [1] and [2].  Calling __stack_chk_fail from functions annotated with
__arm_streaming_compatible will prompt the compiler to emit this
temporary-switching logic, [3] is a primitive reproducer of this behavior.

In principle, we should be able to compile streaming-compatible functions for
targets without SME, since a well-defined streaming-compatible function does
not assume that SME exists.  At first glance, it looks like the compiler is
correctly accepting the __arm_streaming_compatible annotation without +sme, but
SMSTART/SMSTOP are conservatively gated by the assembler - most likely because
reading/writing PSTATE.SM without implementing SME is undefined.

The PSTATE.SM switches are conditional on the incoming state being different
from the target state; AIUI, this codegen is deliberately safe for use in a
non-SME context.

Spencer

[1]
https://github.com/ARM-software/acle/blob/main/main/acle.md#managing-streaming-mode-across-function-boundaries

[2]
https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#671pstatesm-interfaces

[3] https://godbolt.org/z/rM9n8nM1Y

Reply via email to