Added _rdtsc intrinsics by Robert Khasanov

Differential Revision: http://llvm-reviews.chandlerc.com/D3212

llvm-svn: 205172
This commit is contained in:
Alexey Volkov 2014-03-31 08:08:46 +00:00
parent 23aaf2a182
commit ae43aae96a
2 changed files with 10 additions and 6 deletions

View File

@ -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");

View File

@ -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 */