From 9936c912f502142649f9209e84ce78827ee47662 Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Fri, 31 Jan 2014 19:44:55 +0000 Subject: [PATCH] MS Intrin.h: implement __cpuidex and simplify __cpuid The two identical implementations of __cpuid for X86 / X86_64 were leftovers from my first iteration on the patch that implemented it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200568 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Headers/Intrin.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Headers/Intrin.h b/lib/Headers/Intrin.h index 6fd1eeb373..3bb304a311 100644 --- a/lib/Headers/Intrin.h +++ b/lib/Headers/Intrin.h @@ -53,6 +53,7 @@ void __addfsword(unsigned long, unsigned short); void __code_seg(const char *); static __inline__ void __cpuid(int[4], int); +static __inline__ void __cpuidex(int[4], int, int); void __debugbreak(void); __int64 __emul(int, int); @@ -876,14 +877,13 @@ _ReturnAddress(void) { } static __inline__ void __attribute__((__always_inline__, __nodebug__)) __cpuid(int __info[4], int __level) { -#if __i386__ - __asm__ ("cpuid" - : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3]) - : "0"(__level)); -#else __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3]) - : "0"(__level)); -#endif + : "a"(__level)); +} +static __inline__ void __attribute__((__always_inline__, __nodebug__)) +__cpuidex(int __info[4], int __level, int __ecx) { + __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3]) + : "a"(__level), "c"(__ecx)); } static __inline__ unsigned __int64 __cdecl __attribute__((__always_inline__, __nodebug__)) _xgetbv(unsigned int __xcr_no) { -- 2.40.0