CONFIGURE: Enable back SIMD for clang compiler depending on its version

This commit is contained in:
Le Philousophe 2024-09-01 18:51:11 +02:00 committed by Filippos Karapetis
parent f001fa7bbc
commit 0942594524

33
configure vendored
View File

@ -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