Does gcc provide this intrinsic?

Is this assembly correct for x86_64?


On Fri, Mar 28, 2014 at 8:48 AM, Robert Khasanov <[email protected]>wrote:

> Hi rnk, echristo,
>
> This patch moves _rdtsc() intrinsics from Intrin.h to ia32intrin.h as it
> used on windows and linux.
>
>
>
>
> http://llvm-reviews.chandlerc.com/D3212
>
> Files:
>   lib/Headers/Intrin.h
>   lib/Headers/ia32intrin.h
>
> Index: lib/Headers/Intrin.h
> ===================================================================
> --- lib/Headers/Intrin.h
> +++ lib/Headers/Intrin.h
> @@ -976,12 +976,6 @@
>    __asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no));
>    return ((unsigned __int64)__edx << 32) | __eax;
>  }
> -static __inline__ unsigned __int64 __attribute__((__always_inline__,
> __nodebug__))
> -__rdtsc(void) {
> -  unsigned int __eax, __edx;
> -  __asm__ ("rdtsc" : "=a" (__eax), "=d" (__edx));
> -  return ((unsigned __int64)__edx << 32) | __eax;
> -}
>  static __inline__ void __attribute__((__always_inline__, __nodebug__))
>  __halt(void) {
>    __asm__ volatile ("hlt");
> Index: lib/Headers/ia32intrin.h
> ===================================================================
> --- lib/Headers/ia32intrin.h
> +++ lib/Headers/ia32intrin.h
> @@ -79,4 +79,14 @@
>  }
>  #endif /* !__x86_64__ */
>
> +/* __rdtsc */
> +static __inline__ unsigned long long __attribute__((__always_inline__,
> __nodebug__))
> +__rdtsc(void) {
> +  unsigned int __eax, __edx;
> +  __asm__ ("rdtsc" : "=a" (__eax), "=d" (__edx));
> +  return ((unsigned long long)__edx << 32) | __eax;
> +}
> +
> +#define _rdtsc() __rdtsc()
> +
>  #endif /* __IA32INTRIN_H */
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to