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 -mfpmath=387 iff compiler supports it
Date: Tue, 29 Mar 2022 20:31:42 +0000 (GMT)	[thread overview]
Message-ID: <20220329203142.92CB03858C50@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3209c25fd301f5e74a3c2687af628e823a83c221

commit 3209c25fd301f5e74a3c2687af628e823a83c221
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 15:02:05 2022 -0300

    x86: Use -mfpmath=387 iff compiler supports it

Diff:
---
 sysdeps/x86/configure    | 22 ++++++++++++++++++++++
 sysdeps/x86/configure.ac | 10 ++++++++++
 sysdeps/x86/fpu/Makefile |  5 ++++-
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
index 46d436fddf..26296b0aea 100644
--- a/sysdeps/x86/configure
+++ b/sysdeps/x86/configure
@@ -190,6 +190,28 @@ fi
 config_vars="$config_vars
 enable-x86-isa-level = $libc_cv_include_x86_isa_level"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports -mpfmath=387" >&5
+$as_echo_n "checking if compiler supports -mpfmath=387... " >&6; }
+if ${libc_cv_cc_mfpmath_387+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if { ac_try='${CC-cc} -Werror -mfpmath=387 -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_mfpmath_387="-mfpmath=387"
+else
+  libc_cv_cc_mfpmath_387=
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_mfpmath_387" >&5
+$as_echo "$libc_cv_cc_mfpmath_387" >&6; }
+config_vars="$config_vars
+config-cflags-mfpath-387 = $libc_cv_cc_mfpmath_387"
+
 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
 
 
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
index 918b636891..8c2970864a 100644
--- a/sysdeps/x86/configure.ac
+++ b/sysdeps/x86/configure.ac
@@ -128,6 +128,16 @@ if test $libc_cv_include_x86_isa_level = yes; then
 fi
 LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level])
 
+dnl Determine if compiler supports -mfpmath=387
+AC_CACHE_CHECK([if compiler supports -mpfmath=387],
+	       libc_cv_cc_mfpmath_387, [dnl
+LIBC_TRY_CC_OPTION([-Werror -mfpmath=387],
+		   [libc_cv_cc_mfpmath_387="-mfpmath=387"],
+		   [libc_cv_cc_mfpmath_387=])
+])
+LIBC_CONFIG_VAR([config-cflags-mfpath-387],
+		[$libc_cv_cc_mfpmath_387])
+
 dnl It is always possible to access static and hidden symbols in an
 dnl position independent way.
 AC_DEFINE(PI_STATIC_AND_HIDDEN)
diff --git a/sysdeps/x86/fpu/Makefile b/sysdeps/x86/fpu/Makefile
index 68bd42cdd3..2d584dbfeb 100644
--- a/sysdeps/x86/fpu/Makefile
+++ b/sysdeps/x86/fpu/Makefile
@@ -4,7 +4,10 @@ CPPFLAGS += -I../soft-fp
 
 libm-support += powl_helper
 tests += test-fenv-sse test-fenv-clear-sse test-fenv-x87 test-fenv-sse-2 \
-	 test-flt-eval-method-387 test-flt-eval-method-sse
+	 test-flt-eval-method-sse
+ifneq ($(config-cflags-mfpath-387),)
+tests += test-flt-eval-method-387
+endif
 CFLAGS-test-fenv-sse.c += -msse2 -mfpmath=sse
 CFLAGS-test-fenv-clear-sse.c += -msse2 -mfpmath=sse
 CFLAGS-test-fenv-sse-2.c += -msse2 -mfpmath=sse


             reply	other threads:[~2022-03-29 20:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 20:31 Adhemerval Zanella [this message]
2022-03-31 19:08 Adhemerval Zanella
2022-04-04 12:56 Adhemerval Zanella
2022-04-29 14:05 Adhemerval Zanella
2022-05-10 18:26 Adhemerval Zanella
2022-05-12 19:35 Adhemerval Zanella
2022-05-13 14:21 Adhemerval Zanella
2022-06-03 14:07 Adhemerval Zanella
2022-06-09 13:18 Adhemerval Zanella
2022-06-09 21:22 Adhemerval Zanella
2022-10-04 13:01 Adhemerval Zanella
2022-10-28 17:43 Adhemerval Zanella
2023-02-09 19:50 Adhemerval Zanella
2023-08-30 12:38 Adhemerval Zanella
2023-09-28 17:54 Adhemerval Zanella
2023-12-21 18:55 Adhemerval Zanella
2024-01-29 17:59 Adhemerval Zanella
2024-02-07 14:09 Adhemerval Zanella
2024-02-09 17:33 Adhemerval Zanella
2024-04-02 15:55 Adhemerval Zanella
2024-04-17 20:09 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=20220329203142.92CB03858C50@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).