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

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 14 16:18:52 PST 2019


rnk added inline comments.


================
Comment at: lib/Headers/immintrin.h:381-394
+#ifdef _MSC_VER
+#ifdef __cplusplus
+extern "C" {
+#endif
+unsigned __int64 __cdecl _xgetbv(unsigned int);
+void __cdecl _xsetbv(unsigned int, unsigned __int64);
+#ifdef __cplusplus
----------------
I think we should try to simplify immintrin.h and push this complexity into xsaveintrin.h. Since it is small (i.e. not avx512intrin.h), we don't really need this `!defined(_MSC_VER) || __has_feature(modules)` check to improve compile time. If you rewrite it to:
  #if defined(_MSC_VER) || defined(__XSAVE__)
  #include <xsaveintrin.h>
  #endif

Then xsaveintrin.h can do the __XSAVE__ macro feature check internally.


================
Comment at: test/Headers/ms-intrin.cpp:37
 void f() {
   __movsb(0, 0, 0);
   __movsd(0, 0, 0);
----------------
Surely `__movsb` and `__readmsr` should all be x86-only as well, at least according to MSDN?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56686/new/

https://reviews.llvm.org/D56686





More information about the cfe-commits mailing list