aboutsummaryrefslogtreecommitdiff
path: root/test/Headers
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-01-15 05:03:18 +0000
committerCraig Topper <craig.topper@intel.com>2019-01-15 05:03:18 +0000
commit659a479615dc0ce00063d935e6848db0a7653f41 (patch)
tree12193cc23c4597a9f9ab68d4cf5f678a6550315f /test/Headers
parent9b753d5619c5b2be952e0b9b7ab4bb785d4717a3 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Headers')
-rw-r--r--test/Headers/ms-intrin.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/Headers/ms-intrin.cpp b/test/Headers/ms-intrin.cpp
index b0fef9cc06..18bb798203 100644
--- a/test/Headers/ms-intrin.cpp
+++ b/test/Headers/ms-intrin.cpp
@@ -49,7 +49,9 @@ void f() {
int info[4];
__cpuid(info, 0);
__cpuidex(info, 0, 0);
+#if defined(_M_X64) || defined(_M_IX86)
_xgetbv(0);
+#endif
__halt();
__nop();
__readmsr(0);