From eccf47f57a81d591919728016be9a6bd6db5088f Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Mar 2019 21:04:28 +0000 Subject: [PATCH] Enable building libomp.so for 32-bit x86. This is done by selectively enabling the functions that save and restore MXCSR, since access to this register requires SSE support. Note that you may run into other issues with OpenMP on i386, since this *not* yet supported upstream, and certainly not extensively tested. PR: 236062, 236582 MFC after: 1 month X-MFC-With: r344779 --- contrib/openmp/runtime/src/kmp.h | 7 ++++++- contrib/openmp/runtime/src/kmp_runtime.cpp | 2 +- lib/Makefile | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/openmp/runtime/src/kmp.h b/contrib/openmp/runtime/src/kmp.h index 599cbf23a584..fd3bf89d4de3 100644 --- a/contrib/openmp/runtime/src/kmp.h +++ b/contrib/openmp/runtime/src/kmp.h @@ -3666,8 +3666,13 @@ extern int __kmp_read_from_file(char const *path, char const *format, ...); extern void __kmp_query_cpuid(kmp_cpuinfo_t *p); -#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(); } +#else +static inline void __kmp_load_mxcsr(const kmp_uint32 *) {} +static inline void __kmp_store_mxcsr(kmp_uint32 *) {} +#endif extern void __kmp_load_x87_fpu_control_word(kmp_int16 *p); extern void __kmp_store_x87_fpu_control_word(kmp_int16 *p); diff --git a/contrib/openmp/runtime/src/kmp_runtime.cpp b/contrib/openmp/runtime/src/kmp_runtime.cpp index 0db376159fc7..ab7cecb64bd0 100644 --- a/contrib/openmp/runtime/src/kmp_runtime.cpp +++ b/contrib/openmp/runtime/src/kmp_runtime.cpp @@ -8104,7 +8104,7 @@ __kmp_determine_reduction_method( #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS -#if KMP_OS_LINUX || KMP_OS_WINDOWS || KMP_OS_HURD +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_HURD // basic tuning diff --git a/lib/Makefile b/lib/Makefile index 5beb34b21e54..f5e89b0712c4 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -196,9 +196,7 @@ _libproc= libproc _librtld_db= librtld_db .endif -.if !defined(COMPAT_32BIT) SUBDIR.${MK_OPENMP}+= libomp -.endif SUBDIR.${MK_OPENSSL}+= libmp SUBDIR.${MK_PMC}+= libpmc libpmcstat SUBDIR.${MK_RADIUS_SUPPORT}+= libradius