On 7/16/2026 6:45 AM, Jin Ma wrote:
> SIBCALL_REGS excludes t1, so the "j" constraint makes LRA reload a
> sibcall address materialized in t1.  Sibcalls are therefore correct
> without this change.
>
> Use a pseudo for sibcall address materialization so allocation can
> select SIBCALL_REGS directly and avoid the reload.  Keep t1 for normal
> calls.  This is an optimization, not a bug fix.
>
> gcc/ChangeLog:
>
>       * config/riscv/riscv-protos.h
>       (riscv_legitimize_call_address): Add a sibcall parameter.
>       * config/riscv/riscv.cc
>       (riscv_legitimize_call_address): Use a pseudo for sibcalls.
>       * config/riscv/riscv.md (sibcall): Pass true for sibcalls.
>       (sibcall_value): Likewise.
>       (call): Pass false for ordinary calls.
>       (call_value): Likewise.
>
> gcc/testsuite/ChangeLog:
>
>       * gcc.target/riscv/sibcall-materialize-pseudo.c: New test.
Also OK for the trunk.

Thanks again,
jeff

Reply via email to