On Mon, Jul 28, 2025 at 11:40 PM Jakub Jelinek <ja...@redhat.com> wrote:
>
> 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

This is the patch I am checking to -mno-80387.

-- 
H.J.
From 7ce5996492bf107079c6b3f4716adcf71753e741 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Tue, 29 Jul 2025 09:11:34 -0700
Subject: [PATCH] x86: Pass -mno-80387 to compile pr121208-1(a|b).c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Pass -mno-80387 to compile pr121208-1(a|b).c to silence

.../pr121208-1a.c:11:1: sorry, unimplemented: 80387 instructions aren’t allowed in a function with the ‘no_caller_saved_registers’ attribute

	PR target/121208
	* gcc.target/i386/pr121208-1a.c (dg-options): Add -mno-80387.
	* gcc.target/i386/pr121208-1b.c (dg-options): Likewise.

Signed-off-by: H.J. Lu <hjl.to...@gmail.com>
---
 gcc/testsuite/gcc.target/i386/pr121208-1a.c | 2 +-
 gcc/testsuite/gcc.target/i386/pr121208-1b.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/i386/pr121208-1a.c b/gcc/testsuite/gcc.target/i386/pr121208-1a.c
index ac851cb50d8..cb8bd0bc8d2 100644
--- a/gcc/testsuite/gcc.target/i386/pr121208-1a.c
+++ b/gcc/testsuite/gcc.target/i386/pr121208-1a.c
@@ -1,5 +1,5 @@
 /* { dg-do compile { target *-*-linux* } } */
-/* { dg-options "-O2 -fPIC -mtls-dialect=gnu" } */
+/* { dg-options "-O2 -fPIC -mno-80387 -mtls-dialect=gnu" } */
 
 extern __thread int bar;
 extern void func (void);
diff --git a/gcc/testsuite/gcc.target/i386/pr121208-1b.c b/gcc/testsuite/gcc.target/i386/pr121208-1b.c
index b97ac715c65..037e9a0899c 100644
--- a/gcc/testsuite/gcc.target/i386/pr121208-1b.c
+++ b/gcc/testsuite/gcc.target/i386/pr121208-1b.c
@@ -1,4 +1,4 @@
 /* { dg-do compile { target *-*-linux* } } */
-/* { dg-options "-O2 -fPIC -mtls-dialect=gnu2" } */
+/* { dg-options "-O2 -fPIC -mno-80387 -mtls-dialect=gnu2" } */
 
 #include "pr121208-1a.c"
-- 
2.50.1

Reply via email to