i386: Do GNU2 TLS address computation in ptr_mode
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 21 Jan 2020 22:09:53 +0000 (14:09 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 21 Jan 2020 22:10:02 +0000 (14:10 -0800)
commit8e0efc10335bf9bb447f2188254609dcfad7de8a
treec75b0405936dbf46d5100ebd622e8b1b98d22236
parentad09440a09597c34e0b93498aad9d6ef0b8ca9ae
i386: Do GNU2 TLS address computation in ptr_mode

Since GNU2 TLS address from glibc run-time is in ptr_mode, we should do
GNU2 TLS address computation in ptr_mode and zero-extend result to Pmode.

gcc/

PR target/93319
* config/i386/i386.c (ix86_tls_module_base): Replace Pmode
with ptr_mode.
(legitimize_tls_address): Do GNU2 TLS address computation in
ptr_mode and zero-extend result to Pmode.
*  config/i386/i386.md (@tls_dynamic_gnu2_64_<mode>): Replace
:P with :PTR and Pmode with ptr_mode.
(*tls_dynamic_gnu2_lea_64_<mode>): Likewise.
(*tls_dynamic_gnu2_call_64_<mode>): Likewise.
(*tls_dynamic_gnu2_combine_64_<mode>): Likewise.

gcc/testsuite/

PR target/93319
* gcc.target/i386/pr93319-1a.c: Don't include <stdio.h>.
(test1): Replace printf with __builtin_printf.
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr93319-1a.c