From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 0BBBF3858C52; Wed, 17 Apr 2024 20:07:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BBBF3858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713384447; bh=n3kNZcaMn082hb7Bg7laHNAtgO6NY5EMCMk8j+mI6e0=; h=From:To:Subject:Date:From; b=iZPUNfZwDN1STmVkG3GBgpBltgOwxzVBwI4ZyA6WjlopHMFcmOydFjF0ip65zd044 fIb6wyYTRA990Kqx/mig9hjPTM9iYy6vewqIv46EwRXWvJ9CLOZblDQysw1mAl8Iha v0MSS3NAqiNMHWwCZ7BTwSJF2CjVZg5wNBo9a1k4= 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: 774dfa5a5a2631a690ddeda24f652fa849fcbc57 X-Git-Newrev: cc579bf118a04c9e3322cf44712b776fe9434d57 Message-Id: <20240417200727.0BBBF3858C52@sourceware.org> Date: Wed, 17 Apr 2024 20:07:26 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cc579bf118a04c9e3322cf44712b776fe9434d57 commit cc579bf118a04c9e3322cf44712b776fe9434d57 Author: Adhemerval Zanella Date: Thu Mar 10 15:05:51 2022 -0300 x86: Use -msse2avx iff compiler supports it Diff: --- sysdeps/x86_64/configure | 24 ++++++++++++++++++++++++ sysdeps/x86_64/configure.ac | 9 +++++++++ sysdeps/x86_64/fpu/multiarch/Makefile | 14 +++++++------- 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)