about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-10 15:05:51 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:40 -0300
commitcc579bf118a04c9e3322cf44712b776fe9434d57 (patch)
tree60962db638e6e24ed2b3f496b5b9a996cfaeab4a
parent774dfa5a5a2631a690ddeda24f652fa849fcbc57 (diff)
downloadglibc-cc579bf118a04c9e3322cf44712b776fe9434d57.tar.gz
glibc-cc579bf118a04c9e3322cf44712b776fe9434d57.tar.xz
glibc-cc579bf118a04c9e3322cf44712b776fe9434d57.zip
x86: Use -msse2avx iff compiler supports it
-rwxr-xr-xsysdeps/x86_64/configure24
-rw-r--r--sysdeps/x86_64/configure.ac9
-rw-r--r--sysdeps/x86_64/fpu/multiarch/Makefile14
3 files changed, 40 insertions, 7 deletions
diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
index 07bdd40a37..f22ea7c548 100755
--- a/sysdeps/x86_64/configure
+++ b/sysdeps/x86_64/configure
@@ -134,6 +134,30 @@ fi
 config_vars="$config_vars
 enable-cet = $enable_cet"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking -msse2avx" >&5
+printf %s "checking -msse2avx... " >&6; }
+if test ${libc_cv_cc_msse2avx+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -msse2avx -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_msse2avx=-msse2avx
+else $as_nop
+  libc_cv_cc_msse2avx=
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_msse2avx" >&5
+printf "%s\n" "$libc_cv_cc_msse2avx" >&6; }
+config_vars="$config_vars
+config-cflags-msse2avx = $libc_cv_cc_msse2avx"
+
 # Check if -mamx-tile works properly.
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -mamx-tile works properly" >&5
 printf %s "checking whether -mamx-tile works properly... " >&6; }
diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
index c7b68544a2..78157222b8 100644
--- a/sysdeps/x86_64/configure.ac
+++ b/sysdeps/x86_64/configure.ac
@@ -61,6 +61,15 @@ elif test $enable_cet = permissive; then
 fi
 LIBC_CONFIG_VAR([enable-cet], [$enable_cet])
 
+dnl Check if compiler supports -msse2avx
+AC_CACHE_CHECK(-msse2avx, libc_cv_cc_msse2avx, [dnl
+LIBC_TRY_CC_OPTION([-msse2avx],
+		   [libc_cv_cc_msse2avx=-msse2avx],
+		   [libc_cv_cc_msse2avx=])
+])
+LIBC_CONFIG_VAR([config-cflags-msse2avx],
+		[$libc_cv_cc_msse2avx])
+
 # Check if -mamx-tile works properly.
 AC_CACHE_CHECK(whether -mamx-tile works properly,
 	       libc_cv_x86_have_amx_tile, [dnl
diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
index cbe09d49f4..6fccf73d99 100644
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -123,13 +123,13 @@ CFLAGS-s_sin-fma4.c = -mfma4
 CFLAGS-s_tan-fma4.c = -mfma4
 CFLAGS-s_sincos-fma4.c = -mfma4
 
-CFLAGS-e_atan2-avx.c = -msse2avx -DSSE2AVX
-CFLAGS-e_exp-avx.c = -msse2avx -DSSE2AVX
-CFLAGS-e_log-avx.c = -msse2avx -DSSE2AVX
-CFLAGS-s_atan-avx.c = -msse2avx -DSSE2AVX
-CFLAGS-s_sin-avx.c = -msse2avx -DSSE2AVX
-CFLAGS-s_tan-avx.c = -msse2avx -DSSE2AVX
-CFLAGS-s_sincos-avx.c = -msse2avx -DSSE2AVX
+CFLAGS-e_atan2-avx.c = $(config-cflags-msse2avx) -DSSE2AVX
+CFLAGS-e_exp-avx.c = $(config-cflags-msse2avx) -DSSE2AVX
+CFLAGS-e_log-avx.c = $(config-cflags-msse2avx) -DSSE2AVX
+CFLAGS-s_atan-avx.c = $(config-cflags-msse2avx) -DSSE2AVX
+CFLAGS-s_sin-avx.c = $(config-cflags-msse2avx) -DSSE2AVX
+CFLAGS-s_tan-avx.c = $(config-cflags-msse2avx) -DSSE2AVX
+CFLAGS-s_sincos-avx.c = $(config-cflags-msse2avx) -DSSE2AVX
 endif
 
 ifeq ($(subdir),mathvec)