From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id B1A013857359; Tue, 10 May 2022 18:23:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1A013857359 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] x86: Use -msse2avx iff compiler supports it X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 708c1703da0782a36365b34278f14dc54870200d X-Git-Newrev: c673fd98a028e3d832f1e67aaefdf637c0715be7 Message-Id: <20220510182327.B1A013857359@sourceware.org> Date: Tue, 10 May 2022 18:23:27 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2022 18:23:27 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c673fd98a028e3d832f1e67aaefdf637c0715be7 commit c673fd98a028e3d832f1e67aaefdf637c0715be7 Author: Adhemerval Zanella Date: Thu Mar 10 15:05:51 2022 -0300 x86: Use -msse2avx iff compiler supports it Diff: --- sysdeps/x86_64/configure | 22 ++++++++++++++++++++++ sysdeps/x86_64/configure.ac | 9 +++++++++ sysdeps/x86_64/fpu/multiarch/Makefile | 12 ++++++------ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure index 44b6055e55..b113fc6c6c 100755 --- a/sysdeps/x86_64/configure +++ b/sysdeps/x86_64/configure @@ -27,5 +27,27 @@ if test x"$build_mathvec" = xnotset; then build_mathvec=yes fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking -msse2avx" >&5 +$as_echo_n "checking -msse2avx... " >&6; } +if ${libc_cv_cc_msse2avx+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + libc_cv_cc_msse2avx=-msse2avx +else + libc_cv_cc_msse2avx= +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_msse2avx" >&5 +$as_echo "$libc_cv_cc_msse2avx" >&6; } +config_vars="$config_vars +config-cflags-msse2avx = $libc_cv_cc_msse2avx" + test -n "$critic_missing" && as_fn_error $? " *** $critic_missing" "$LINENO" 5 diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac index 1215dcb1e4..5f176b1ef0 100644 --- a/sysdeps/x86_64/configure.ac +++ b/sysdeps/x86_64/configure.ac @@ -14,5 +14,14 @@ if test x"$build_mathvec" = xnotset; then build_mathvec=yes fi +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]) + test -n "$critic_missing" && AC_MSG_ERROR([ *** $critic_missing]) diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile index ec796277a5..0721bc8c3f 100644 --- a/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/sysdeps/x86_64/fpu/multiarch/Makefile @@ -50,12 +50,12 @@ CFLAGS-s_tan-fma4.c = -mfma4 libm-sysdep_routines += e_exp-avx e_log-avx s_atan-avx \ e_atan2-avx s_sin-avx s_tan-avx -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-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 endif ifeq ($(subdir),mathvec)