diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h index d336a51669a..591394076cc 100644 --- a/gcc/config/i386/ia32intrin.h +++ b/gcc/config/i386/ia32intrin.h @@ -107,22 +107,12 @@ __rdpmc (int __S) #endif /* __iamcu__ */ /* rdtsc */ -extern __inline unsigned long long -__attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__rdtsc (void) -{ - return __builtin_ia32_rdtsc (); -} +#define __rdtsc() __builtin_ia32_rdtsc () #ifndef __iamcu__ /* rdtscp */ -extern __inline unsigned long long -__attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__rdtscp (unsigned int *__A) -{ - return __builtin_ia32_rdtscp (__A); -} +#define __rdtscp(a) __builtin_ia32_rdtscp (a) #endif /* __iamcu__ */ diff --git a/gcc/testsuite/gcc.target/i386/pr99744-1.c b/gcc/testsuite/gcc.target/i386/pr99744-1.c new file mode 100644 index 00000000000..a5a905c732a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99744-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +#include + +extern unsigned long long int curr_deadline; +extern void bar (void); + +__attribute__ ((target("general-regs-only"))) +void +foo1 (void) +{ + if (__rdtsc () < curr_deadline) + return; + bar (); +} + +__attribute__ ((target("general-regs-only"))) +void +foo2 (unsigned int *p) +{ + if (__rdtscp (p) < curr_deadline) + return; + bar (); +}