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] Use -ffloat-store iff compiler supports it
Date: Wed, 30 Aug 2023 12:38:00 +0000 (GMT)	[thread overview]
Message-ID: <20230830123800.567903854148@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=58c049fccb3b6a40f88a7c14600677ca8da1fa5e

commit 58c049fccb3b6a40f88a7c14600677ca8da1fa5e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 24 13:12:43 2022 -0300

    Use -ffloat-store iff compiler supports it

Diff:
---
 configure     | 24 ++++++++++++++++++++++++
 configure.ac  | 10 ++++++++++
 math/Makefile |  4 ++--
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 004108d180..0f3c8818d3 100755
--- a/configure
+++ b/configure
@@ -7466,6 +7466,30 @@ printf "%s\n" "$libc_cv_cc_rounding_math" >&6; }
 config_vars="$config_vars
 config-cflags-frounding-math = $libc_cv_cc_rounding_math"
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compiler option that -ffloat-store" >&5
+printf %s "checking for compiler option that -ffloat-store... " >&6; }
+if test ${libc_cv_cc_float_store+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  if { ac_try='${CC-cc} -Werror -ffloat-store -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_float_store=-ffloat-store
+else $as_nop
+  libc_cv_cc_float_store=
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_float_store" >&5
+printf "%s\n" "$libc_cv_cc_float_store" >&6; }
+config_vars="$config_vars
+config-cflags-float-store = $libc_cv_cc_float_store"
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__))" >&5
 printf %s "checking if $CC accepts -fno-tree-loop-distribute-patterns with \
diff --git a/configure.ac b/configure.ac
index ecb4e7086e..7a9df2818a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1535,6 +1535,16 @@ LIBC_TRY_CC_OPTION([-Werror -frounding-math],
 LIBC_CONFIG_VAR([config-cflags-frounding-math],
 	       	[$libc_cv_cc_rounding_math])
 
+dnl Determine if compiler supports -ffloat-store
+AC_CACHE_CHECK([for compiler option that -ffloat-store],
+	       libc_cv_cc_float_store, [dnl
+LIBC_TRY_CC_OPTION([-Werror -ffloat-store],
+		   [libc_cv_cc_float_store=-ffloat-store],
+		   [libc_cv_cc_float_store=])
+])
+LIBC_CONFIG_VAR([config-cflags-float-store],
+		[$libc_cv_cc_float_store])
+
 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
 cat > conftest.c <<EOF
diff --git a/math/Makefile b/math/Makefile
index 3e9701c0d1..85a9cb3026 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -407,7 +407,7 @@ $(objpfx)test-tgmath3-macro-list.out: gen-tgmath-tests.py
 
 libm-test-fast-math-cflags = -fno-builtin -D__FAST_MATH__ -DTEST_FAST_MATH
 libm-test-vec-cflags = $(libm-test-fast-math-cflags) -fno-inline \
-		       -ffloat-store -D_OPENMP=201307 -Wno-unknown-pragmas
+		       $(libc_cv_cc_float_store) -D_OPENMP=201307 -Wno-unknown-pragmas
 
 CFLAGS-test-double-vlen4-wrappers.c += $(double-vlen4-arch-ext-cflags)
 
@@ -423,7 +423,7 @@ CFLAGS-test-float-vlen16-wrappers.c += $(float-vlen16-arch-ext-cflags)
 # raise spurious exceptions for sNaNs, but also do not test for
 # exceptions.  Thus both versions of the classification macros are
 # validated.
-libm-test-no-inline-cflags = -fno-inline -ffloat-store -fno-builtin \
+libm-test-no-inline-cflags = -fno-inline $(libc_cv_cc_float_store) -fno-builtin \
 			     $(config-cflags-signaling-nans)
 CFLAGS-test-tgmath.c += -fno-builtin
 # The following testcase uses very long lines (>3 million), so it may take a

             reply	other threads:[~2023-08-30 12:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 12:38 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-17 20:08 Adhemerval Zanella
2024-04-02 15:55 Adhemerval Zanella
2024-02-09 17:33 Adhemerval Zanella
2024-02-07 14:08 Adhemerval Zanella
2024-01-29 17:58 Adhemerval Zanella
2023-12-21 18:55 Adhemerval Zanella
2023-09-28 17:53 Adhemerval Zanella
2023-02-09 19:49 Adhemerval Zanella
2022-10-28 17:43 Adhemerval Zanella
2022-10-04 13:00 Adhemerval Zanella
2022-06-09 21:21 Adhemerval Zanella
2022-06-09 13:18 Adhemerval Zanella
2022-06-03 14:07 Adhemerval Zanella
2022-05-13 14:21 Adhemerval Zanella
2022-05-12 19:35 Adhemerval Zanella
2022-05-10 18:25 Adhemerval Zanella
2022-04-29 14:05 Adhemerval Zanella
2022-04-04 12:55 Adhemerval Zanella
2022-03-31 19:08 Adhemerval Zanella
2022-03-29 20:31 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=20230830123800.567903854148@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).