x86: Define _serialize as macro

Define _serialize as macro for callers with general-regs-only target
attribute to avoid inline failure with always_inline attribute.

gcc/

	PR target/99744
	* config/i386/serializeintrin.h (_serialize): Defined as macro.

gcc/testsuite/

	PR target/99744
	* gcc.target/i386/pr99744-2.c: New test.
This commit is contained in:
H.J. Lu 2021-04-09 11:44:32 -07:00
parent 22aede7a12
commit 71958f740f
2 changed files with 12 additions and 6 deletions

View File

@ -34,12 +34,7 @@
#define __DISABLE_SERIALIZE__
#endif /* __SERIALIZE__ */
extern __inline void
__attribute__((__gnu_inline__, __always_inline__, __artificial__))
_serialize (void)
{
__builtin_ia32_serialize ();
}
#define _serialize() __builtin_ia32_serialize ()
#ifdef __DISABLE_SERIALIZE__
#undef __DISABLE_SERIALIZE__

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mserialize" } */
#include <x86intrin.h>
__attribute__ ((target("general-regs-only")))
void
foo1 (void)
{
_serialize ();
}