summaryrefslogtreecommitdiff
path: root/gcc/configure.ac
diff options
context:
space:
mode:
authorMarius Hillenbrand <mhillen@linux.ibm.com>2020-12-01 11:02:27 +0100
committerAndreas Krebbel <krebbel@linux.ibm.com>2020-12-01 11:29:09 +0100
commita5dd6b69fcbe74c02d4821ac2daf2b8c9f819f6e (patch)
tree78b146b12ca2fe39d2170da0e04c2eb9d1f9da52 /gcc/configure.ac
parentcffd725c0eb44daa0234f3af39cd94ad97f2833d (diff)
downloadgcc-a5dd6b69fcbe74c02d4821ac2daf2b8c9f819f6e.tar.gz
IBM Z: Configure excess precision for float at compile-time
Historically, float_t has been defined as double on s390 and gcc would emit double precision insns for evaluating float expressions when in standard-compliant mode. Configure that behavior at compile-time as prep for changes in glibc: When glibc ties float_t to double, keep the old behavior; when glibc derives float_t from FLT_EVAL_METHOD (as on most other archs), revert to the default behavior (i.e., FLT_EVAL_METHOD_PROMOTE_TO_FLOAT). Provide a configure option --enable-s390-excess-float-precision to override the check. gcc/ChangeLog: 2020-12-01 Marius Hillenbrand <mhillen@linux.ibm.com> * configure.ac: Add configure option --enable-s390-excess-float-precision and check to derive default from glibc. * config/s390/s390.c: Guard s390_excess_precision with an ifdef for ENABLE_S390_EXCESS_FLOAT_PRECISION. * doc/install.texi: Document --enable-s390-excess-float-precision. * configure: Regenerate. * config.in: Regenerate.
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r--gcc/configure.ac45
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b410428b4fc..24679a540c1 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7318,6 +7318,51 @@ if test x"$ld_pushpopstate_support" = xyes; then
fi
AC_MSG_RESULT($ld_pushpopstate_support)
+# On s390, float_t has historically been statically defined as double for no
+# good reason. To comply with the C standard in the light of this definition,
+# gcc has evaluated float expressions in double precision when in
+# standards-compatible mode or when given -fexcess-precision=standard. To enable
+# a smooth transition towards the new model used by most architectures, where
+# gcc describes its behavior via the macro __FLT_EVAL_METHOD__ and glibc derives
+# float_t from that, this behavior can be configured with
+# --enable-s390-excess-float-precision. When given as enabled, that flag selects
+# the old model. When omitted, native builds will derive the flag from the
+# behavior of glibc. When glibc clamps float_t to double, gcc follows the old
+# model. In any other case, it defaults to the new model.
+AC_ARG_ENABLE(s390-excess-float-precision,
+ [AS_HELP_STRING([--enable-s390-excess-float-precision],
+ [on s390 targets, evaluate float with double precision
+ when in standards-conforming mode])],
+ [],[enable_s390_excess_float_precision=auto])
+
+case $target in
+ s390*-linux*)
+ if test "$target" = "$host" -a "$host" = "$build" -a \
+ x"$enable_s390_excess_float_precision" = xauto; then
+ AC_CACHE_CHECK([for glibc clamping float_t to double],
+ gcc_cv_float_t_clamped_to_double,
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([
+#define __FLT_EVAL_METHOD__ 0
+#include <math.h>
+int main() {
+ return !(sizeof(float_t) == sizeof(double));
+}])],
+ [gcc_cv_float_t_clamped_to_double=yes],
+ [gcc_cv_float_t_clamped_to_double=no])])
+ if test x"$gcc_cv_float_t_clamped_to_double" = xyes; then
+ enable_s390_excess_float_precision=yes
+ fi
+ fi
+
+ GCC_TARGET_TEMPLATE(ENABLE_S390_EXCESS_FLOAT_PRECISION)
+ if test x"$enable_s390_excess_float_precision" = xyes; then
+ AC_DEFINE(ENABLE_S390_EXCESS_FLOAT_PRECISION, 1,
+[Define to enable evaluating float expressions with double precision in
+standards-compatible mode on s390 targets.])
+ fi
+ ;;
+esac
+
# Configure the subdirectories
# AC_CONFIG_SUBDIRS($subdirs)