]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Add support for __arm_locally_streaming
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Dec 2023 10:11:29 +0000 (10:11 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Dec 2023 10:11:29 +0000 (10:11 +0000)
commit3f6e5991fab507aa79121dc44d1afcd622c78744
tree50444db41ae4237468e6c6b31654184b678123af
parent4f6ab9537051e156d52bd8e9df40107ba6685895
aarch64: Add support for __arm_locally_streaming

This patch adds support for the __arm_locally_streaming attribute,
which allows a function to use SME internally without changing
the function's ABI.  The attribute is valid but redundant for
__arm_streaming functions.

gcc/
* config/aarch64/aarch64.cc (aarch64_arm_attribute_table): Add
arm::locally_streaming.
(aarch64_fndecl_is_locally_streaming): New function.
(aarch64_fndecl_sm_state): Handle locally-streaming functions.
(aarch64_cfun_enables_pstate_sm): New function.
(aarch64_add_offset): Add an argument that specifies whether
the streaming vector length should be used instead of the
prevailing one.
(aarch64_split_add_offset, aarch64_add_sp, aarch64_sub_sp): Likewise.
(aarch64_allocate_and_probe_stack_space): Likewise.
(aarch64_expand_mov_immediate): Update calls accordingly.
(aarch64_need_old_pstate_sm): Return true for locally-streaming
streaming-compatible functions.
(aarch64_layout_frame): Force all call-preserved Z and P registers
to be saved and restored if the function switches PSTATE.SM in the
prologue.
(aarch64_get_separate_components): Disable shrink-wrapping of
such Z and P saves and restores.
(aarch64_use_late_prologue_epilogue): New function.
(aarch64_expand_prologue): Measure SVE lengths in the streaming
vector length for locally-streaming functions, then emit code
to enable streaming mode.
(aarch64_expand_epilogue): Likewise in reverse.
(TARGET_USE_LATE_PROLOGUE_EPILOGUE): Define.
* config/aarch64/aarch64-c.cc (aarch64_define_unconditional_macros):
Define __arm_locally_streaming.

gcc/testsuite/
* gcc.target/aarch64/sme/locally_streaming_1.c: New test.
* gcc.target/aarch64/sme/locally_streaming_2.c: Likewise.
* gcc.target/aarch64/sme/locally_streaming_3.c: Likewise.
* gcc.target/aarch64/sme/locally_streaming_4.c: Likewise.
* gcc.target/aarch64/sme/keyword_macros_1.c: Add
__arm_locally_streaming.
* g++.target/aarch64/sme/keyword_macros_1.C: Likewise.
gcc/config/aarch64/aarch64-c.cc
gcc/config/aarch64/aarch64.cc
gcc/testsuite/g++.target/aarch64/sme/keyword_macros_1.C
gcc/testsuite/gcc.target/aarch64/sme/keyword_macros_1.c
gcc/testsuite/gcc.target/aarch64/sme/locally_streaming_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sme/locally_streaming_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sme/locally_streaming_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sme/locally_streaming_4.c [new file with mode: 0644]