diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-06-08 15:54:40 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-06-08 15:54:40 +0000 |
commit | 0ac902b8173023f2783ec00112325d3ccf872549 (patch) | |
tree | 853145480dcadfabfd0c2c77b5f288a30386ebe7 | |
parent | 500a3b7fc2b3bac0a5d0045d24b02d3b6836b4ce (diff) | |
download | mpfr-0ac902b8173023f2783ec00112325d3ccf872549.tar.gz |
[acinclude.m4] Fixed subnormal detection (issue found with icx).
git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14538 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | acinclude.m4 | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 0ba8a37b7..a9f622a11 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -310,14 +310,18 @@ dnl neither tests would be reliable on implementations with partial dnl subnormal support. Anyway, this check is useful only for the dnl tests. Thus in doubt, assume that subnormals are not supported, dnl in order to disable the corresponding tests (which could fail). +dnl Note: "volatile" is needed to avoid -ffast-math optimizations +dnl (default in icx 2021.2.0, which also sets the FZ and DAZ bits +dnl of the x86-64 MXCSR register to disregard subnormals). AC_CACHE_CHECK([for subnormal double-precision numbers], mpfr_cv_have_subnorm_dbl, [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdio.h> int main (void) { - double x = 2.22507385850720138309e-308; - fprintf (stderr, "%e\n", x / 2.0); - return 2.0 * (double) (x / 2.0) != x; + volatile double x = 2.22507385850720138309e-308, y; + y = x / 2.0; + fprintf (stderr, "%e\n", y); + return 2.0 * y != x; } ]])], [mpfr_cv_have_subnorm_dbl="yes"], @@ -333,9 +337,10 @@ mpfr_cv_have_subnorm_flt, [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <stdio.h> int main (void) { - float x = 1.17549435082229e-38; - fprintf (stderr, "%e\n", x / 2.0); - return 2.0 * (float) (x / 2.0) != x; + volatile float x = 1.17549435082229e-38, y; + y = x / 2.0; + fprintf (stderr, "%e\n", (double) y); + return 2.0 * y != x; } ]])], [mpfr_cv_have_subnorm_flt="yes"], |