From ae43aae96a82bc2c69c569cb3e7f4f02f4c04955 Mon Sep 17 00:00:00 2001 From: Alexey Volkov Date: Mon, 31 Mar 2014 08:08:46 +0000 Subject: [PATCH] Added _rdtsc intrinsics by Robert Khasanov Differential Revision: http://llvm-reviews.chandlerc.com/D3212 llvm-svn: 205172 --- clang/lib/Headers/Intrin.h | 6 ------ clang/lib/Headers/ia32intrin.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/clang/lib/Headers/Intrin.h b/clang/lib/Headers/Intrin.h index 90a218e62971..e365abe9a72e 100644 --- a/clang/lib/Headers/Intrin.h +++ b/clang/lib/Headers/Intrin.h @@ -976,12 +976,6 @@ _xgetbv(unsigned int __xcr_no) { __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"); diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h index 8f5925469ad7..a5985f660bbb 100644 --- a/clang/lib/Headers/ia32intrin.h +++ b/clang/lib/Headers/ia32intrin.h @@ -79,4 +79,14 @@ __writeeflags(unsigned int __f) } #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 */