On Fri, Nov 22, 2024 at 9:50 AM Jakub Jelinek <ja...@redhat.com> wrote: > > Hi! > > 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. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2024-11-22 Jakub Jelinek <ja...@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.
OK. Thanks, Uros. > > --- gcc/config/i386/i386-builtin.def.jj 2024-11-06 10:19:11.418260865 +0100 > +++ gcc/config/i386/i386-builtin.def 2024-11-21 11:39:05.245410674 +0100 > @@ -94,10 +94,10 @@ BDESC (0, 0, CODE_FOR_nothing, "__builti > 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) > --- gcc/testsuite/gcc.target/i386/pr117165.c.jj 2024-11-21 11:46:07.971413045 > +0100 > +++ gcc/testsuite/gcc.target/i386/pr117165.c 2024-11-21 11:45:44.849741064 > +0100 > @@ -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" } */ > +} > > Jakub >