[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ceil, floor: avoid spurious failure with icc
From: |
Eric Blake |
Subject: |
[PATCH] ceil, floor: avoid spurious failure with icc |
Date: |
Fri, 5 Nov 2010 16:30:16 -0600 |
* tests/test-ceilf2.c (ceilf_reference): Avoid icc's use of DAZ
[denormals-as-zero] when optimizing without -mieee-fp option.
* tests/test-floorf2.c (floorf_reference): Likewise.
Signed-off-by: Eric Blake <address@hidden>
---
This fixes failures of icc without -mieee-fp on test-{ceil,floor}f2.c.
However, it does not fix test-{ceil,floor}f1.c, where my recent testsuite
improvements flushed out the following compiler quirk:
icc -mieee-fp, as well as icc -O0 (which is also implied by icc -g),
emit a call to ceilf(); therefore, if -lm has a working
implementation, then configure detects that it is working, lib/ceil.c
is never compiled, and the test passes. But icc -O2 (which is the
default with plain icc) recognizes ceilf and inlines it into assembly
code that unfortunately turns -0.0f into 0.0. Technically, this is
not a bug, since POSIX is explicit that compliance of -0.0f is an
optional feature, if you are not compliant with the <MX> option.
And, since I'm still not sure I want to force -mieee-fp onto all
gnulib projects, that means I'm still scratching my head for a way
to either defeat icc's insistence on inlining ceilf, or I'll have
to tighten m4/ceilf.m4 to detect when icc is being used without full
IEEE compliance.
ChangeLog | 5 +++++
tests/test-ceilf2.c | 3 +++
tests/test-floorf2.c | 3 +++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cce182c..b853aad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-11-05 Eric Blake <address@hidden>
+ ceil, floor: avoid spurious failure with icc
+ * tests/test-ceilf2.c (ceilf_reference): Avoid icc's use of DAZ
+ [denormals-as-zero] when optimizing without -mieee-fp option.
+ * tests/test-floorf2.c (floorf_reference): Likewise.
+
tests: require working signbit
* modules/ceilf-tests (Depends-on): Add signbit.
* modules/ceill-tests (Depends-on): Likewise.
diff --git a/tests/test-ceilf2.c b/tests/test-ceilf2.c
index 705c19a..3455cbf 100644
--- a/tests/test-ceilf2.c
+++ b/tests/test-ceilf2.c
@@ -63,6 +63,9 @@ ceilf_reference (DOUBLE x)
if (z > L_(0.0))
{
+ /* Work around ICC's desire to optimize denormal floats to 0. */
+ if (z < FLT_MIN)
+ return L_(1.0);
/* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */
if (z < TWO_MANT_DIG)
{
diff --git a/tests/test-floorf2.c b/tests/test-floorf2.c
index b26a508..6811728 100644
--- a/tests/test-floorf2.c
+++ b/tests/test-floorf2.c
@@ -76,6 +76,9 @@ floorf_reference (DOUBLE x)
}
else if (z < L_(0.0))
{
+ /* Work around ICC's desire to optimize denormal floats to 0. */
+ if (z > -FLT_MIN)
+ return L_(-1.0);
/* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */
if (z > - TWO_MANT_DIG)
{
--
1.7.3.2
- Re: icc bug on test-frexp-nolibm, (continued)
- Re: icc bug on test-frexp-nolibm, Eric Blake, 2010/11/04
- [PATCH 2/2] ceil, floor, round, trunc: enhance tests of -0, Eric Blake, 2010/11/04
- [PATCH 1/2] frexp, tests: work around ICC bug with -zero, Eric Blake, 2010/11/04
- Re: icc bug on test-frexp-nolibm, Eric Blake, 2010/11/05
- Re: icc bug on test-frexp-nolibm, Eric Blake, 2010/11/05