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

Dimitry Andric via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Apr 19 13:28:42 PDT 2019

dim created this revision.
dim added reviewers: emaste, jlpeyton, Hahnfeld.
Herald added subscribers: openmp-commits, jdoerfert, krytarowski.
Herald added a project: OpenMP.

To be able to successfully build OpenMP on FreeBSD/i386, which still
uses i486 as its default processor, I had to provide wrappers for the
`__kmp_load_mxcsr` and `__kmp_store_mxcsr` functions.

If the compiler signals that SSE is not available, loading and storing
mxcsr does not make sense anway, so in that case the inline functions
are empty.  This gives the minimum amount of code churn.

See also https://svnweb.freebsd.org/changeset/base/345283

  rOMP OpenMP



Index: runtime/src/kmp.h
--- runtime/src/kmp.h
+++ runtime/src/kmp.h
@@ -1209,8 +1209,13 @@
 extern void __kmp_clear_x87_fpu_status_word();
 #endif // KMP_OS_UNIX
-#define __kmp_load_mxcsr(p) _mm_setcsr(*(p))
+#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(); }
+static inline void __kmp_load_mxcsr(const kmp_uint32 *) {}
+static inline void __kmp_store_mxcsr(kmp_uint32 *) {}
 #define KMP_X86_MXCSR_MASK 0xffffffc0 /* ignore status flags (6 lsb) */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60916.195902.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190419/eaecc276/attachment.bin>

More information about the Openmp-commits mailing list