i386: Make __builtin_ia32_f{nstenv,ldenv,nstsw,fnclex} builtins internal [PR117165]

As the comment says, these builtins are meant to be internal for the atomic
support and cause various ICEs when using them directly in various
conditions.
So the following patch makes them internal.
We do have also internal-fn.*, but those target specific builtins would
need to be there in generic code, so I've just added space to their name,
which is the old way to hide builtins/attributes etc.

2024-11-22  Jakub Jelinek  <jakub@redhat.com>

	PR target/117165
	* config/i386/i386-builtin.def (IX86_BUILTIN_FNSTENV,
	IX86_BUILTIN_FLDENV, IX86_BUILTIN_FNSTSW, IX86_BUILTIN_FNCLEX): Add
	space to the end of the builtin name to make it really internal.

	* gcc.target/i386/pr117165.c: New test.
This commit is contained in:
Jakub Jelinek 2024-11-22 11:33:34 +01:00 committed by Jakub Jelinek
parent 77f4b1097e
commit d6d1fdcf95
2 changed files with 31 additions and 4 deletions

View File

@ -94,10 +94,10 @@ BDESC (0, 0, CODE_FOR_nothing, "__builtin_ia32_rdpmc", IX86_BUILTIN_RDPMC, UNKNO
BDESC (0, 0, CODE_FOR_pause, "__builtin_ia32_pause", IX86_BUILTIN_PAUSE, UNKNOWN, (int) VOID_FTYPE_VOID)
/* 80387 (for use internally for atomic compound assignment). */
BDESC (0, 0, CODE_FOR_fnstenv, "__builtin_ia32_fnstenv", IX86_BUILTIN_FNSTENV, UNKNOWN, (int) VOID_FTYPE_PVOID)
BDESC (0, 0, CODE_FOR_fldenv, "__builtin_ia32_fldenv", IX86_BUILTIN_FLDENV, UNKNOWN, (int) VOID_FTYPE_PCVOID)
BDESC (0, 0, CODE_FOR_fnstsw, "__builtin_ia32_fnstsw", IX86_BUILTIN_FNSTSW, UNKNOWN, (int) USHORT_FTYPE_VOID)
BDESC (0, 0, CODE_FOR_fnclex, "__builtin_ia32_fnclex", IX86_BUILTIN_FNCLEX, UNKNOWN, (int) VOID_FTYPE_VOID)
BDESC (0, 0, CODE_FOR_fnstenv, "__builtin_ia32_fnstenv ", IX86_BUILTIN_FNSTENV, UNKNOWN, (int) VOID_FTYPE_PVOID)
BDESC (0, 0, CODE_FOR_fldenv, "__builtin_ia32_fldenv ", IX86_BUILTIN_FLDENV, UNKNOWN, (int) VOID_FTYPE_PCVOID)
BDESC (0, 0, CODE_FOR_fnstsw, "__builtin_ia32_fnstsw ", IX86_BUILTIN_FNSTSW, UNKNOWN, (int) USHORT_FTYPE_VOID)
BDESC (0, 0, CODE_FOR_fnclex, "__builtin_ia32_fnclex ", IX86_BUILTIN_FNCLEX, UNKNOWN, (int) VOID_FTYPE_VOID)
/* MMX */
BDESC (OPTION_MASK_ISA_MMX, 0, CODE_FOR_mmx_emms, "__builtin_ia32_emms", IX86_BUILTIN_EMMS, UNKNOWN, (int) VOID_FTYPE_VOID)

View File

@ -0,0 +1,27 @@
/* PR target/117165 */
/* { dg-do compile } */
/* { dg-options "-msoft-float" } */
void
foo ()
{
__builtin_ia32_fnstsw (); /* { dg-error "implicit declaration of function" } */
}
void
bar ()
{
__builtin_ia32_fnclex (); /* { dg-error "implicit declaration of function" } */
}
void
baz ()
{
__builtin_ia32_fnstenv (0); /* { dg-error "implicit declaration of function" } */
}
void
qux ()
{
__builtin_ia32_fldenv (0); /* { dg-error "implicit declaration of function" } */
}