From 7ceec07cf6be763267f757b3bc1b1cd46eccf89c Mon Sep 17 00:00:00 2001 From: Andrea Di Biagio Date: Thu, 24 Apr 2014 18:26:35 +0000 Subject: [X86] Add Clang support for intrinsics __rdtsc and __rdtscp. This patch: 1. Adds a definition for two new GCCBuiltins in BuiltinsX86.def: __builtin_ia32_rdtsc; __builtin_ia32_rdtscp; 2. Replaces the already existing definition of intrinsic __rdtsc in ia32intrin.h with a simple call to the new GCC builtin __builtin_ia32_rdtsc. 3. Adds a definition for the new intrinsic __rdtscp in ia32intrin.h llvm-svn: 207132 --- clang/lib/Headers/ia32intrin.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/Headers/ia32intrin.h b/clang/lib/Headers/ia32intrin.h index a5985f660bb..55c22473ba7 100644 --- a/clang/lib/Headers/ia32intrin.h +++ b/clang/lib/Headers/ia32intrin.h @@ -82,9 +82,13 @@ __writeeflags(unsigned int __f) /* __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; + return __builtin_ia32_rdtsc(); +} + +/* __rdtscp */ +static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__)) +__rdtscp(unsigned int *__A) { + return __builtin_ia32_rdtscp(__A); } #define _rdtsc() __rdtsc() -- cgit v1.2.3