]> granicus.if.org Git - clang/commitdiff
Intrin.h: implement __rdtsc and __halt
authorHans Wennborg <hans@hanshq.net>
Tue, 28 Jan 2014 22:55:01 +0000 (22:55 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 28 Jan 2014 22:55:01 +0000 (22:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200343 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/Intrin.h

index 6005adfcd4ebe7b71d40fd8b1c9b570466467443..992fabf7aace263229136b64727be910f7ba49c6 100644 (file)
@@ -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
 }