public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] x86: Use -msse2avx iff compiler supports it
Date: Thu,  9 Jun 2022 13:16:05 +0000 (GMT)	[thread overview]
Message-ID: <20220609131605.A34DC38376C5@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=647e080a2c107a33de7b6bcba5a7e48208095b15

commit 647e080a2c107a33de7b6bcba5a7e48208095b15
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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 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 248162525b..66b519b242 100644
--- a/sysdeps/x86_64/fpu/multiarch/Makefile
+++ b/sysdeps/x86_64/fpu/multiarch/Makefile
@@ -55,13 +55,13 @@ libm-sysdep_routines += e_exp-avx e_log-avx s_atan-avx \
 			e_atan2-avx s_sin-avx s_tan-avx \
 			s_sincos-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-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)


             reply	other threads:[~2022-06-09 13:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 13:16 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-09 17:31 Adhemerval Zanella
2024-02-07 14:07 Adhemerval Zanella
2024-01-29 17:57 Adhemerval Zanella
2023-12-21 18:53 Adhemerval Zanella
2023-09-28 17:52 Adhemerval Zanella
2023-08-30 12:36 Adhemerval Zanella
2023-02-09 19:48 Adhemerval Zanella
2022-10-28 17:41 Adhemerval Zanella
2022-10-04 12:59 Adhemerval Zanella
2022-06-09 21:19 Adhemerval Zanella
2022-06-03 14:05 Adhemerval Zanella
2022-05-13 14:19 Adhemerval Zanella
2022-05-12 19:33 Adhemerval Zanella
2022-05-10 18:23 Adhemerval Zanella
2022-04-29 14:03 Adhemerval Zanella
2022-04-04 12:53 Adhemerval Zanella
2022-03-31 19:06 Adhemerval Zanella
2022-03-29 20:29 Adhemerval Zanella
2022-03-16 18:02 Adhemerval Zanella
2022-03-15 18:40 Adhemerval Zanella
2022-03-11 17:24 Adhemerval Zanella
2022-03-10 19:23 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220609131605.A34DC38376C5@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).