From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 8C456385773F; Wed, 30 Aug 2023 12:36:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C456385773F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693398973; bh=WOQwfC6q4n4v2J1bUe0we8aM6DWNK6eeFJnuvPill/E=; h=From:To:Subject:Date:From; b=f3ZahXJ3hGM2ghMLxf/cS6byoxaIyuM0JqIkCS+jQFV8UFnjowwXrQQsXVrl9onVm tW3BcZSouvd6pRjcSLCnGeb/8n2/bUcYSYObhlXgnTm8Q4x/FfeqDzrqoq6dUo3d+K aAu2d2LI/69Tql7lZnGl0KhYnRDcrQar0cgygjck= 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: 45e0da3467843b1c2adf62a68a083a9446914a43 X-Git-Newrev: 5e88a335f16a24ed79965c3528bad34c962a2421 Message-Id: <20230830123613.8C456385773F@sourceware.org> Date: Wed, 30 Aug 2023 12:36:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5e88a335f16a24ed79965c3528bad34c962a2421 commit 5e88a335f16a24ed79965c3528bad34c962a2421 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 | 14 +++++++------- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure index e307467afa..5b4984e5f6 100755 --- a/sysdeps/x86_64/configure +++ b/sysdeps/x86_64/configure @@ -29,6 +29,28 @@ 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 0253edf027..2346a5a27a 100644 --- a/sysdeps/x86_64/fpu/multiarch/Makefile +++ b/sysdeps/x86_64/fpu/multiarch/Makefile @@ -117,13 +117,13 @@ libm-sysdep_routines += \ s_tan-avx \ # libm-sysdep_routines -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)