[PATCH] D15839: Move _xgetbv to immintrin.h
Ehsan Akhgari via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 31 13:40:09 PST 2015
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");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15839.43837.patch
Type: text/x-patch
Size: 1183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151231/85d7ce16/attachment.bin>
More information about the cfe-commits
mailing list