aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dimitry@andric.com>2019-05-06 17:58:03 +0000
committerDimitry Andric <dimitry@andric.com>2019-05-06 17:58:03 +0000
commitaebe831622403337fabe44206f5d497e066c761e (patch)
treea860bd2a91b1a6217770f9b96fcead514c24f3ae
parentae9830cdb86118db1283a1d00a6dde82ab2b201e (diff)
Add non-SSE wrapper for __kmp_{load,store}_mxcsr
Summary: 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 Reviewers: emaste, jlpeyton, Hahnfeld Reviewed By: jlpeyton Subscribers: hfinkel, krytarowski, jdoerfert, openmp-commits, llvm-commits Tags: #openmp Differential Revision: https://reviews.llvm.org/D60916 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@360062 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--runtime/src/kmp.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h
index b9a9599..7224538 100644
--- a/runtime/src/kmp.h
+++ b/runtime/src/kmp.h
@@ -1243,16 +1243,22 @@ static inline void __kmp_clear_x87_fpu_status_word() {
__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) */