[PATCH] D56686: [X86] Make _xgetbv/_xsetbv on non-windows platforms

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 14 15:59:00 PST 2019


craig.topper created this revision.
craig.topper added reviewers: rnk, RKSimon, spatel.

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.


https://reviews.llvm.org/D56686

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56686.181662.patch
Type: text/x-patch
Size: 14973 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190114/09bf8fd0/attachment.bin>


More information about the cfe-commits mailing list