diff options
| author | Hans Wennborg <hans@hanshq.net> | 2014-01-28 22:55:01 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2014-01-28 22:55:01 +0000 |
| commit | 740a4d6e4633de866d328cf2bb15c08af49c923d (patch) | |
| tree | f479fd584a74be24004b6e1646a1b5793a233d5d /clang/lib | |
| parent | f40ef45c9d85a694c235cddba08235f50f0030a1 (diff) | |
| download | bcm5719-llvm-740a4d6e4633de866d328cf2bb15c08af49c923d.tar.gz bcm5719-llvm-740a4d6e4633de866d328cf2bb15c08af49c923d.zip | |
Intrin.h: implement __rdtsc and __halt
llvm-svn: 200343
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Headers/Intrin.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Headers/Intrin.h b/clang/lib/Headers/Intrin.h index 6005adfcd4e..992fabf7aac 100644 --- a/clang/lib/Headers/Intrin.h +++ b/clang/lib/Headers/Intrin.h @@ -56,6 +56,7 @@ __int64 __emul(int, int); unsigned __int64 __emulu(unsigned int, unsigned int); void __cdecl __fastfail(unsigned int); unsigned int __getcallerseflags(void); +static __inline__ void __halt(void); unsigned char __inbyte(unsigned short); void __inbytestring(unsigned short, unsigned char *, unsigned long); @@ -92,6 +93,7 @@ static __inline__ unsigned int __popcnt(unsigned int); static __inline__ unsigned short __popcnt16(unsigned short); +static __inline__ unsigned __int64 __rdtsc(void); unsigned __int64 __rdtscp(unsigned int *); unsigned long __readcr0(void); @@ -889,6 +891,16 @@ _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"); +} #ifdef __cplusplus } |

