]> granicus.if.org Git - clang/commit
[X86] Make _xgetbv/_xsetbv on non-windows platforms
authorCraig Topper <craig.topper@intel.com>
Tue, 15 Jan 2019 05:03:18 +0000 (05:03 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 15 Jan 2019 05:03:18 +0000 (05:03 +0000)
commit659a479615dc0ce00063d935e6848db0a7653f41
tree12193cc23c4597a9f9ab68d4cf5f678a6550315f
parent9b753d5619c5b2be952e0b9b7ab4bb785d4717a3
[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
include/clang/Basic/BuiltinsX86.def
lib/CodeGen/CGBuiltin.cpp
lib/Headers/immintrin.h
lib/Headers/intrin.h
lib/Headers/xsaveintrin.h
test/CodeGen/builtins-x86.c
test/CodeGen/x86_32-xsave.c
test/CodeGen/x86_64-xsave.c
test/Headers/ms-intrin.cpp