ldbl-128: Refactor modfl snan handling
Commit Message
This causes a test failure on float128/ppc64le
as the multiplication is optimized away. This
updates it to use conversions similar to other
files.
Tested on s390x to verify no new test failures
occur. This also reduced the code size a little
bit too.
* sysdeps/ieee754/ldbl-128/s_modfl.c (one): Removed.
(__modfl): Use more compiler friendly mechanism
to quiet an snan.
---
sysdeps/ieee754/ldbl-128/s_modfl.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Comments
On Mon, 8 Aug 2016, Paul E. Murphy wrote:
> This causes a test failure on float128/ppc64le
> as the multiplication is optimized away. This
> updates it to use conversions similar to other
> files.
This patch is not relative to current glibc. You'll also need to explain
why the
# These files quiet sNaNs in a way that is optimized away without
# -fsignaling-nans.
CFLAGS-s_modf.c += -fsignaling-nans
CFLAGS-s_modff.c += -fsignaling-nans
CFLAGS-s_modfl.c += -fsignaling-nans
in math/Makefile isn't working, as it is for all the similar
implementations and other architectures.
On 08/08/2016 10:20 AM, Joseph Myers wrote:
> On Mon, 8 Aug 2016, Paul E. Murphy wrote:
>
>> This causes a test failure on float128/ppc64le
>> as the multiplication is optimized away. This
>> updates it to use conversions similar to other
>> files.
>
> This patch is not relative to current glibc. You'll also need to explain
> why the
>
> # These files quiet sNaNs in a way that is optimized away without
> # -fsignaling-nans.
> CFLAGS-s_modf.c += -fsignaling-nans
> CFLAGS-s_modff.c += -fsignaling-nans
> CFLAGS-s_modfl.c += -fsignaling-nans
>
> in math/Makefile isn't working, as it is for all the similar
> implementations and other architectures.
>
And, I missed that little bit of makefile. Thank you for
pointing it out. I'll drop the patch for now.
Is there a practical, reusable mechanism to apply a
set of CFLAGS to a list of objects derived from a make
variable without using eval? Florian raised this issue
earlier and received no feedback.
Likewise, the same question applies to my proposed
patches to refactor the _Complex wrappers.
On Mon, 8 Aug 2016, Paul E. Murphy wrote:
> Is there a practical, reusable mechanism to apply a
> set of CFLAGS to a list of objects derived from a make
> variable without using eval? Florian raised this issue
> earlier and received no feedback.
I have no advice on that question.
@@ -30,8 +30,6 @@ static char rcsid[] = "$NetBSD: $";
#include <math.h>
#include <math_private.h>
-static const ldouble_t one = 1.0;
-
ldouble_t __modfl(ldouble_t x, ldouble_t *iptr)
{
int64_t i0,i1,j0;
@@ -56,14 +54,15 @@ ldouble_t __modfl(ldouble_t x, ldouble_t *iptr)
}
}
} else if (j0>111) { /* no fraction part */
- *iptr = x*one;
/* We must handle NaNs separately. */
if (j0 == 0x4000 && ((i0 & 0x0000ffffffffffffLL) | i1))
{
- *iptr = x+x;
- return x+x;
+ /* Coerce x and iptr into qnans. */
+ *iptr = x + x;
+ return *iptr;
}
/* return +-0 */
+ *iptr = x;
SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
return x;
} else { /* fraction part in low x */