On Tue, Apr 29, 2025 at 9:56 AM H.J. Lu <hjl.to...@gmail.com> wrote:
>
> Don't expand UNSPEC_TLS_LD_BASE to a call so that the RTL local copy
> propagation pass can eliminate multiple __tls_get_addr calls.

__tls_get_addr needs to be called with 16-byte aligned stack, I don't
think the compiler will correctly handle required call alignment if
you emit the call without emit_libcall_block.

Uros.

>
> gcc/
>
> PR target/81501
> * config/i386/i386-protos.h (ix86_split_tls_local_dynamic_base_64):
> New.
> * config/i386/i386.cc (ix86_split_tls_local_dynamic_base_64): New.
> (legitimize_tls_address): Don't emit the 64-bit UNSPEC_TLS_LD_BASE
> as a call.
> * config/i386/i386.md (*tls_local_dynamic_base_64_<mode>): Renamed
> to ...
> (@tls_local_dynamic_base_call_64_<mode>): This.  Replace
> (match_operand 2) with (const_int 0).
> (@tls_local_dynamic_base_64_<mode>): Change call to unspec.
> (*tls_local_dynamic_base_64_<mode>): New.
>
> gcc/testsuite/
>
> PR target/81501
> * gcc.target/i386/pr81501-1.c: New test.
>
> OK for master?
>
> Thanks.
>
> --
> H.J.

Reply via email to