On Sat, Jul 26, 2025 at 10:37:35AM -0700, H.J. Lu wrote:
> __tls_get_addr doesn't preserve vector registers. When a function
> with no_caller_saved_registers attribute calls __tls_get_addr, YMM
> and ZMM registers will be clobbered. Issue an error and suggest
> -mtls-dialect=gnu2 in this case.
>
> gcc/
>
> PR target/121208
> * config/i386/i386.cc (ix86_tls_get_addr): Issue an error for
> -mtls-dialect=gnu with no_caller_saved_registers attribute and
> suggest -mtls-dialect=gnu2.
>
> gcc/testsuite/
>
> PR target/121208
> * gcc.target/i386/pr121208-1a.c: New test.
> * gcc.target/i386/pr121208-1b.c: Likewise.
The above 2 tests FAIL on i686-linux:
spawn -ignore SIGHUP /home/jakub/src/gcc/obj91/gcc/xgcc
-B/home/jakub/src/gcc/obj91/gcc/
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1a.c
-fdiagnostics-plain-output -O2 -fPIC -mtls-dialect=gnu -S -o pr121208-1a.s
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1a.c: In function
'foo':
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1a.c:10:1: sorry,
unimplemented: 80387 instructions aren't allowed in a function with the
'no_caller_saved_registers' attribute
compiler exited with status 1
FAIL: gcc.target/i386/pr121208-1a.c (test for errors, line 11)
FAIL: gcc.target/i386/pr121208-1a.c (test for excess errors)
Excess errors:
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1a.c:10:1: sorry,
unimplemented: 80387 instructions aren't allowed in a function with the
'no_caller_saved_registers' attribute
Executing on host: /home/jakub/src/gcc/obj91/gcc/xgcc
-B/home/jakub/src/gcc/obj91/gcc/
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1b.c
-fdiagnostics-plain-output -O2 -fPIC -mtls-dialect=gnu2 -S -o pr121208-1b.s
(timeout = 300)
spawn -ignore SIGHUP /home/jakub/src/gcc/obj91/gcc/xgcc
-B/home/jakub/src/gcc/obj91/gcc/
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1b.c
-fdiagnostics-plain-output -O2 -fPIC -mtls-dialect=gnu2 -S -o pr121208-1b.s
In file included from
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1b.c:4:
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1a.c: In function
'foo':
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1a.c:10:1: sorry,
unimplemented: 80387 instructions aren't allowed in a function with the
'no_caller_saved_registers' attribute
compiler exited with status 1
FAIL: gcc.target/i386/pr121208-1b.c (test for excess errors)
Excess errors:
/home/jakub/src/gcc/gcc/testsuite/gcc.target/i386/pr121208-1a.c:10:1: sorry,
unimplemented: 80387 instructions aren't allowed in a function with the
'no_caller_saved_registers' attribute
Dunno if you want to add -msse to dg-options or tweak those tests
in some different way.
Jakub