ehsan created this revision. ehsan added a reviewer: hansw. ehsan added a subscriber: cfe-commits.
The documentation in https://msdn.microsoft.com/en-us/library/hh977022.aspx says that this intrinsic is defined in immintrin.h, and that's the header where MSVC declares this intrinsic, but clang-cl mistakenly provides it in intrin.h. http://reviews.llvm.org/D15839 Files: lib/Headers/Intrin.h lib/Headers/xsaveintrin.h Index: lib/Headers/xsaveintrin.h =================================================================== --- lib/Headers/xsaveintrin.h +++ lib/Headers/xsaveintrin.h @@ -53,6 +53,15 @@ } #endif +#if defined(__i386__) || defined(__x86_64__) +static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS +_xgetbv(unsigned int __xcr_no) { + unsigned int __eax, __edx; + __asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no)); + return ((unsigned __int64)__edx << 32) | __eax; +} +#endif + #undef __DEFAULT_FN_ATTRS #endif Index: lib/Headers/Intrin.h =================================================================== --- lib/Headers/Intrin.h +++ lib/Headers/Intrin.h @@ -905,12 +905,6 @@ __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3]) : "a"(__level), "c"(__ecx)); } -static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS -_xgetbv(unsigned int __xcr_no) { - unsigned int __eax, __edx; - __asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no)); - return ((unsigned __int64)__edx << 32) | __eax; -} static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile ("hlt");
Index: lib/Headers/xsaveintrin.h =================================================================== --- lib/Headers/xsaveintrin.h +++ lib/Headers/xsaveintrin.h @@ -53,6 +53,15 @@ } #endif +#if defined(__i386__) || defined(__x86_64__) +static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS +_xgetbv(unsigned int __xcr_no) { + unsigned int __eax, __edx; + __asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no)); + return ((unsigned __int64)__edx << 32) | __eax; +} +#endif + #undef __DEFAULT_FN_ATTRS #endif Index: lib/Headers/Intrin.h =================================================================== --- lib/Headers/Intrin.h +++ lib/Headers/Intrin.h @@ -905,12 +905,6 @@ __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3]) : "a"(__level), "c"(__ecx)); } -static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS -_xgetbv(unsigned int __xcr_no) { - unsigned int __eax, __edx; - __asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no)); - return ((unsigned __int64)__edx << 32) | __eax; -} static __inline__ void __DEFAULT_FN_ATTRS __halt(void) { __asm__ volatile ("hlt");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits