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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Richard Sandiford <[email protected]>:

https://gcc.gnu.org/g:0de5c20b72a738782e31acce771c6f2085e1014b

commit r15-6703-g0de5c20b72a738782e31acce771c6f2085e1014b
Author: Richard Sandiford <[email protected]>
Date:   Wed Jan 8 18:20:47 2025 +0000

    aarch64: Fix overly restrictive sibcall check [PR107102]

    aarch64_function_ok_for_sibcall required the caller and callee
    to use the same PCS variant.  However, it should be enough for the
    callee to preserve at least as much register state as the caller;
    preserving more state is fine.

    ARM_PCS_AAPCS64, ARM_PCS_SIMD, and ARM_PCS_SVE agree on what
    GPRs should be preserved.  For the others:

    - ARM_PCS_AAPCS64 preserves D8-D15
    - ARM_PCS_SIMD preserves Q8-Q23
    - ARM_PCS_SVE preserves Z8-Z23 + P4-P15

    Thus it's ok for something earlier in the list to tail call something
    later in the list.

    gcc/
            PR target/107102
            * config/aarch64/aarch64.cc (aarch64_function_ok_for_sibcall): Only
            reject calls with different PCSes if the callee clobbers register
            state that the caller must preserve.

    gcc/testsuite/
            PR target/107102
            * gcc.target/aarch64/sve/sibcall_1.c: New test.

Reply via email to