diff options
author | Craig Topper <craig.topper@intel.com> | 2019-01-15 05:03:18 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2019-01-15 05:03:18 +0000 |
commit | 69aed7c3646a18a13595609fa87af8f9cb18cf7f (patch) | |
tree | 5ae14b3054371570b542dbf5db97d0aa6282dafc /clang/lib/Headers/intrin.h | |
parent | 86e68fda3b1b3ebe712bb06558b863de2784be29 (diff) | |
download | bcm5719-llvm-69aed7c3646a18a13595609fa87af8f9cb18cf7f.tar.gz bcm5719-llvm-69aed7c3646a18a13595609fa87af8f9cb18cf7f.zip |
[X86] Make _xgetbv/_xsetbv on non-windows platforms
Summary:
This patch attempts to redo what was tried in r278783, but was reverted.
These intrinsics should be available on non-windows platforms with "xsave" feature check. But on Windows platforms they shouldn't have feature check since that's how MSVC behaves.
To accomplish this I've added a MS builtin with no feature check. And a normal gcc builtin with a feature check. When _MSC_VER is not defined _xgetbv/_xsetbv will be macros pointing to the gcc builtin name.
I've moved the forward declarations from intrin.h to immintrin.h to match the MSDN documentation and used that as the header file for the MS builtin.
I'm not super happy with this implementation, and I'm open to suggestions for better ways to do it.
Reviewers: rnk, RKSimon, spatel
Reviewed By: rnk
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D56686
llvm-svn: 351160
Diffstat (limited to 'clang/lib/Headers/intrin.h')
-rw-r--r-- | clang/lib/Headers/intrin.h | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h index c86f41faeb8..acc08abaf03 100644 --- a/clang/lib/Headers/intrin.h +++ b/clang/lib/Headers/intrin.h @@ -200,10 +200,7 @@ __attribute__((__deprecated__("use other intrinsics or C++11 atomics instead"))) _WriteBarrier(void); unsigned __int32 xbegin(void); void _xend(void); -static __inline__ #define _XCR_XFEATURE_ENABLED_MASK 0 -unsigned __int64 __cdecl _xgetbv(unsigned int); -void __cdecl _xsetbv(unsigned int, unsigned __int64); /* These additional intrinsics are turned on in x64/amd64/x86_64 mode. */ #ifdef __x86_64__ @@ -539,12 +536,6 @@ __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 __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"); |