[PATCH] D60916: Add non-SSE wrapper for __kmp_{load,store}_mxcsr

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 12:53:26 PDT 2019


dim updated this revision to Diff 197619.
dim added a comment.

Address review comments:

- Assign zero to pointed-to value in `__kmp_store_mxcsr()`
- Use SSE specific stuff in `KMP_OS_UNIX` part only


Repository:
  rOMP OpenMP

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

https://reviews.llvm.org/D60916

Files:
  runtime/src/kmp.h


Index: runtime/src/kmp.h
===================================================================
--- runtime/src/kmp.h
+++ runtime/src/kmp.h
@@ -1243,16 +1243,22 @@
   __asm__ __volatile__("fnclex");
 #endif // KMP_MIC
 }
+#if __SSE__
+static inline void __kmp_load_mxcsr(const kmp_uint32 *p) { _mm_setcsr(*p); }
+static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = _mm_getcsr(); }
 #else
+static inline void __kmp_load_mxcsr(const kmp_uint32 *p) {}
+static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = 0; }
+#endif
+#else
 // Windows still has these as external functions in assembly file
 extern void __kmp_x86_cpuid(int mode, int mode2, struct kmp_cpuid *p);
 extern void __kmp_load_x87_fpu_control_word(const kmp_int16 *p);
 extern void __kmp_store_x87_fpu_control_word(kmp_int16 *p);
 extern void __kmp_clear_x87_fpu_status_word();
-#endif // KMP_OS_UNIX
-
-#define __kmp_load_mxcsr(p) _mm_setcsr(*(p))
+static inline void __kmp_load_mxcsr(const kmp_uint32 *p) { _mm_setcsr(*p); }
 static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = _mm_getcsr(); }
+#endif // KMP_OS_UNIX
 
 #define KMP_X86_MXCSR_MASK 0xffffffc0 /* ignore status flags (6 lsb) */
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60916.197619.patch
Type: text/x-patch
Size: 1172 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190501/512563c9/attachment.bin>


More information about the llvm-commits mailing list