From 094259452467acbf6e1214f3a65a17c56fbe60fc Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Sun, 1 Sep 2024 18:51:11 +0200 Subject: [PATCH] CONFIGURE: Enable back SIMD for clang compiler depending on its version --- configure | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 1b65aca283f..4f56a2d074b 100755 --- a/configure +++ b/configure @@ -2282,6 +2282,9 @@ if test "$have_gcc" = yes; then cxx_version="`echo "${cxx_version}" | sed -e 's/"\([^ ]*\) .*/\1/'`" cxx_version="clang $cxx_version, ok" + _clang_major=`gcc_get_define __clang_major__` + _clang_minor=`gcc_get_define __clang_minor__` + append_var CXXFLAGS "-Wshadow" else cxx_version="GCC $cxx_version, ok" @@ -7133,7 +7136,35 @@ case $_host_cpu in ;; esac -if test "$have_gcc" = yes; then +if test "$have_clang" = yes; then + # Clang has variable support to target gating of intrinsics + case $_host_cpu in + i[3-6]86) + # SSE2 and AVX2 has been target gated since LLVM 5.0 + if (test $_clang_major -lt 5) || (test $_clang_major -eq 5 && test $_clang_minor -lt 0); then + _ext_sse2=no + _ext_avx2=no + fi + ;; + arm*) + # NEON has been target gated since LLVM 19.1 + if (test $_clang_major -lt 19) || (test $_clang_major -eq 19 && test $_clang_minor -lt 1); then + # But several platforms enables it globally... + if ! echo "$CXXFLAGS" | grep -q -e -mfpu=neon; then + _ext_neon=no + fi + fi + ;; + x86_64 | amd64) + # AVX2 has been target gated since LLVM 5.0 + # x86_64 always supports SSE2, no need of gating + if (test $_clang_major -lt 5) || (test $_clang_major -eq 5 && test $_clang_minor -lt 0); then + _ext_avx2=no + fi + ;; + # aarch64 always supports NEON, no need of gating + esac +elif test "$have_gcc" = yes; then # Need 4.9 for pragma target if (test $_cxx_major -lt 4) || (test $_cxx_major -eq 4 && test $_cxx_minor -lt 9); then _ext_sse2=no