about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-24 13:12:43 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:40 -0300
commit0062fcb8bab9fcaddf129bedb0c4f06b1670ad34 (patch)
treeed7be760255e979b9b1aca21718d11fb1e12bb5b
parent9193695399a8e6cf79a9825a7ef480f21e080583 (diff)
downloadglibc-0062fcb8bab9fcaddf129bedb0c4f06b1670ad34.tar.gz
glibc-0062fcb8bab9fcaddf129bedb0c4f06b1670ad34.tar.xz
glibc-0062fcb8bab9fcaddf129bedb0c4f06b1670ad34.zip
Use -ffloat-store iff compiler supports it
-rwxr-xr-xconfigure24
-rw-r--r--configure.ac10
-rw-r--r--math/Makefile4
3 files changed, 36 insertions, 2 deletions
diff --git a/configure b/configure
index 56120b2f93..f907145b24 100755
--- a/configure
+++ b/configure
@@ -7368,6 +7368,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 4007e207e8..ff3f62c063 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1481,6 +1481,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 192c4fb820..da5d041d6c 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -936,7 +936,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)
 
@@ -952,7 +952,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