* [PATCH 2/4] alpha: fix floor on sNaN input
2016-07-10 11:40 [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Aurelien Jarno
2016-07-10 11:40 ` [PATCH v2 4/4] alpha: fix trunc for big input values Aurelien Jarno
2016-07-10 11:40 ` [PATCH 3/4] alpha: fix rint on sNaN input Aurelien Jarno
@ 2016-07-10 11:40 ` Aurelien Jarno
2016-07-10 11:57 ` [PATCH 1/4] alpha: fix ceil " Aurelien Jarno
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2016-07-10 11:40 UTC (permalink / raw)
To: libc-alpha; +Cc: Aurelien Jarno
The alpha version of floor wrongly return sNaN for sNaN input. Fix that
by checking for NaN and by returning the input value added with itself
in that case.
Finally remove the code to handle inexact exception, floor should never
generate such an exception.
Changelog:
* sysdeps/alpha/fpu/s_floor.c (__floor): Add argument with itself
when it is a NaN.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_floorf.c (__floorf): Likewise.
---
ChangeLog | 4 ++++
sysdeps/alpha/fpu/s_floor.c | 7 +++----
sysdeps/alpha/fpu/s_floorf.c | 7 +++----
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 681904f..5528047 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
when it is a NaN.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_ceilf.c (__ceilf): Likewise.
+ * sysdeps/alpha/fpu/s_floor.c (__floor): Add argument with itself
+ when it is a NaN.
+ [_IEEE_FP_INEXACT] Remove.
+ * sysdeps/alpha/fpu/s_floorf.c (__floorf): Likewise.
2016-07-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/sysdeps/alpha/fpu/s_floor.c b/sysdeps/alpha/fpu/s_floor.c
index 1a6f8c4..9930f6b 100644
--- a/sysdeps/alpha/fpu/s_floor.c
+++ b/sysdeps/alpha/fpu/s_floor.c
@@ -27,16 +27,15 @@
double
__floor (double x)
{
+ if (isnan (x))
+ return x + x;
+
if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
{
double tmp1, new_x;
__asm (
-#ifdef _IEEE_FP_INEXACT
- "cvttq/svim %2,%1\n\t"
-#else
"cvttq/svm %2,%1\n\t"
-#endif
"cvtqt/m %1,%0\n\t"
: "=f"(new_x), "=&f"(tmp1)
: "f"(x));
diff --git a/sysdeps/alpha/fpu/s_floorf.c b/sysdeps/alpha/fpu/s_floorf.c
index 8cd80e2..015c04f 100644
--- a/sysdeps/alpha/fpu/s_floorf.c
+++ b/sysdeps/alpha/fpu/s_floorf.c
@@ -26,6 +26,9 @@
float
__floorf (float x)
{
+ if (isnanf (x))
+ return x + x;
+
if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
{
/* Note that Alpha S_Floating is stored in registers in a
@@ -36,11 +39,7 @@ __floorf (float x)
float tmp1, tmp2, new_x;
__asm ("cvtst/s %3,%2\n\t"
-#ifdef _IEEE_FP_INEXACT
- "cvttq/svim %2,%1\n\t"
-#else
"cvttq/svm %2,%1\n\t"
-#endif
"cvtqt/m %1,%0\n\t"
: "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
: "f"(x));
--
2.8.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] alpha: fix rint on sNaN input
2016-07-10 11:40 [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Aurelien Jarno
2016-07-10 11:40 ` [PATCH v2 4/4] alpha: fix trunc for big input values Aurelien Jarno
@ 2016-07-10 11:40 ` Aurelien Jarno
2016-07-10 11:40 ` [PATCH 2/4] alpha: fix floor " Aurelien Jarno
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2016-07-10 11:40 UTC (permalink / raw)
To: libc-alpha; +Cc: Aurelien Jarno
The alpha version of rint wrongly return sNaN for sNaN input. Fix that
by checking for NaN and by returning the input value added with itself
in that case.
Changelog:
* sysdeps/alpha/fpu/s_rint.c (__rint): Add argument with itself
when it is a NaN.
* sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise.
---
ChangeLog | 3 +++
sysdeps/alpha/fpu/s_rint.c | 3 +++
sysdeps/alpha/fpu/s_rintf.c | 3 +++
3 files changed, 9 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 5528047..c7dbf18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
when it is a NaN.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_floorf.c (__floorf): Likewise.
+ * sysdeps/alpha/fpu/s_rint.c (__rint): Add argument with itself
+ when it is a NaN.
+ * sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise.
2016-07-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/sysdeps/alpha/fpu/s_rint.c b/sysdeps/alpha/fpu/s_rint.c
index f33fe72..259348a 100644
--- a/sysdeps/alpha/fpu/s_rint.c
+++ b/sysdeps/alpha/fpu/s_rint.c
@@ -23,6 +23,9 @@
double
__rint (double x)
{
+ if (isnan (x))
+ return x + x;
+
if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
{
double tmp1, new_x;
diff --git a/sysdeps/alpha/fpu/s_rintf.c b/sysdeps/alpha/fpu/s_rintf.c
index 1400dfe..645728a 100644
--- a/sysdeps/alpha/fpu/s_rintf.c
+++ b/sysdeps/alpha/fpu/s_rintf.c
@@ -22,6 +22,9 @@
float
__rintf (float x)
{
+ if (isnanf (x))
+ return x + x;
+
if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
{
/* Note that Alpha S_Floating is stored in registers in a
--
2.8.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes
@ 2016-07-10 11:40 Aurelien Jarno
2016-07-10 11:40 ` [PATCH v2 4/4] alpha: fix trunc for big input values Aurelien Jarno
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Aurelien Jarno @ 2016-07-10 11:40 UTC (permalink / raw)
To: libc-alpha; +Cc: Aurelien Jarno
The math testsuite recently got improved with some additional tests.
Unfortunately they they fail on alpha. This patch series aim to fix
the corresponding math functions.
Aurelien Jarno (4):
alpha: fix ceil on sNaN input
alpha: fix floor on sNaN input
alpha: fix rint on sNaN input
alpha: fix trunc for big input values
ChangeLog | 20 ++++++++++++++++++++
sysdeps/alpha/fpu/s_ceil.c | 7 +++----
sysdeps/alpha/fpu/s_ceilf.c | 7 +++----
sysdeps/alpha/fpu/s_floor.c | 7 +++----
sysdeps/alpha/fpu/s_floorf.c | 7 +++----
sysdeps/alpha/fpu/s_rint.c | 3 +++
sysdeps/alpha/fpu/s_rintf.c | 3 +++
sysdeps/alpha/fpu/s_trunc.c | 7 +++----
sysdeps/alpha/fpu/s_truncf.c | 7 +++----
9 files changed, 44 insertions(+), 24 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 4/4] alpha: fix trunc for big input values
2016-07-10 11:40 [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Aurelien Jarno
@ 2016-07-10 11:40 ` Aurelien Jarno
2016-07-10 11:40 ` [PATCH 3/4] alpha: fix rint on sNaN input Aurelien Jarno
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2016-07-10 11:40 UTC (permalink / raw)
To: libc-alpha; +Cc: Aurelien Jarno
The alpha specific version of trunc and truncf always add and subtract
0x1.0p23 or 0x1.0p52 even for big values. This causes this kind of
errors in the testsuite:
Failure: Test: trunc_towardzero (0x1p107)
Result:
is: 1.6225927682921334e+32 0x1.fffffffffffffp+106
should be: 1.6225927682921336e+32 0x1.0000000000000p+107
difference: 1.8014398509481984e+16 0x1.0000000000000p+54
ulp : 0.5000
max.ulp : 0.0000
Change this by returning the input value when its absolute value is
greater than 0x1.0p23 or 0x1.0p52. NaN have to go through the add and
subtract operations to get possibly silenced.
Finally remove the code to handle inexact exception, trunc should never
generate such an exception.
Changelog:
* sysdeps/alpha/fpu/s_trunc.c (__trunc): Return the input value
when its absolute value is greater than 0x1.0p52.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_truncf.c (__truncf): Return the input value
when its absolute value is greater than 0x1.0p23.
[_IEEE_FP_INEXACT] Remove.
---
ChangeLog | 6 ++++++
sysdeps/alpha/fpu/s_trunc.c | 7 +++----
sysdeps/alpha/fpu/s_truncf.c | 7 +++----
3 files changed, 12 insertions(+), 8 deletions(-)
v1 -> v2:
- use isgreaterequal instead of checking for nan and doing a comparison
diff --git a/ChangeLog b/ChangeLog
index c7dbf18..2168d31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,12 @@
* sysdeps/alpha/fpu/s_rint.c (__rint): Add argument with itself
when it is a NaN.
* sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise.
+ * sysdeps/alpha/fpu/s_trunc.c (__trunc): Return the input value
+ when its absolute value is greater than 0x1.0p52.
+ [_IEEE_FP_INEXACT] Remove.
+ * sysdeps/alpha/fpu/s_truncf.c (__truncf): Return the input value
+ when its absolute value is greater than 0x1.0p23.
+ [_IEEE_FP_INEXACT] Remove.
2016-07-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/sysdeps/alpha/fpu/s_trunc.c b/sysdeps/alpha/fpu/s_trunc.c
index 16cb114..4b986a6 100644
--- a/sysdeps/alpha/fpu/s_trunc.c
+++ b/sysdeps/alpha/fpu/s_trunc.c
@@ -28,12 +28,11 @@ __trunc (double x)
double two52 = copysign (0x1.0p52, x);
double r, tmp;
+ if (isgreaterequal (fabs (x), 0x1.0p52))
+ return x;
+
__asm (
-#ifdef _IEEE_FP_INEXACT
- "addt/suic %2, %3, %1\n\tsubt/suic %1, %3, %0"
-#else
"addt/suc %2, %3, %1\n\tsubt/suc %1, %3, %0"
-#endif
: "=&f"(r), "=&f"(tmp)
: "f"(x), "f"(two52));
diff --git a/sysdeps/alpha/fpu/s_truncf.c b/sysdeps/alpha/fpu/s_truncf.c
index 2290f28..3e93356 100644
--- a/sysdeps/alpha/fpu/s_truncf.c
+++ b/sysdeps/alpha/fpu/s_truncf.c
@@ -27,12 +27,11 @@ __truncf (float x)
float two23 = copysignf (0x1.0p23, x);
float r, tmp;
+ if (isgreaterequal (fabsf (x), 0x1.0p23))
+ return x;
+
__asm (
-#ifdef _IEEE_FP_INEXACT
- "adds/suic %2, %3, %1\n\tsubs/suic %1, %3, %0"
-#else
"adds/suc %2, %3, %1\n\tsubs/suc %1, %3, %0"
-#endif
: "=&f"(r), "=&f"(tmp)
: "f"(x), "f"(two23));
--
2.8.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] alpha: fix ceil on sNaN input
2016-07-10 11:40 [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Aurelien Jarno
` (2 preceding siblings ...)
2016-07-10 11:40 ` [PATCH 2/4] alpha: fix floor " Aurelien Jarno
@ 2016-07-10 11:57 ` Aurelien Jarno
2016-07-22 3:36 ` [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Richard Henderson
2016-08-01 19:04 ` Matt Turner
5 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2016-07-10 11:57 UTC (permalink / raw)
To: libc-alpha; +Cc: Aurelien Jarno
The alpha version of ceil wrongly return sNaN for sNaN input. Fix that
by checking for NaN and by returning the input value added with itself
in that case.
Finally remove the code to handle inexact exception, ceil should never
generate such an exception.
Changelog:
* sysdeps/alpha/fpu/s_ceil.c (__ceil): Add argument with itself
when it is a NaN.
[_IEEE_FP_INEXACT] Remove.
* sysdeps/alpha/fpu/s_ceilf.c (__ceilf): Likewise.
---
ChangeLog | 7 +++++++
sysdeps/alpha/fpu/s_ceil.c | 7 +++----
sysdeps/alpha/fpu/s_ceilf.c | 7 +++----
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 222e4d3..681904f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-07-10 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/alpha/fpu/s_ceil.c (__ceil): Add argument with itself
+ when it is a NaN.
+ [_IEEE_FP_INEXACT] Remove.
+ * sysdeps/alpha/fpu/s_ceilf.c (__ceilf): Likewise.
+
2016-07-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/unix/sysv/linux/sysdep.h
diff --git a/sysdeps/alpha/fpu/s_ceil.c b/sysdeps/alpha/fpu/s_ceil.c
index c1ff864..e9c350a 100644
--- a/sysdeps/alpha/fpu/s_ceil.c
+++ b/sysdeps/alpha/fpu/s_ceil.c
@@ -26,17 +26,16 @@
double
__ceil (double x)
{
+ if (isnan (x))
+ return x + x;
+
if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
{
double tmp1, new_x;
new_x = -x;
__asm (
-#ifdef _IEEE_FP_INEXACT
- "cvttq/svim %2,%1\n\t"
-#else
"cvttq/svm %2,%1\n\t"
-#endif
"cvtqt/m %1,%0\n\t"
: "=f"(new_x), "=&f"(tmp1)
: "f"(new_x));
diff --git a/sysdeps/alpha/fpu/s_ceilf.c b/sysdeps/alpha/fpu/s_ceilf.c
index 7e63a6f..77e01a9 100644
--- a/sysdeps/alpha/fpu/s_ceilf.c
+++ b/sysdeps/alpha/fpu/s_ceilf.c
@@ -25,6 +25,9 @@
float
__ceilf (float x)
{
+ if (isnanf (x))
+ return x + x;
+
if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
{
/* Note that Alpha S_Floating is stored in registers in a
@@ -36,11 +39,7 @@ __ceilf (float x)
new_x = -x;
__asm ("cvtst/s %3,%2\n\t"
-#ifdef _IEEE_FP_INEXACT
- "cvttq/svim %2,%1\n\t"
-#else
"cvttq/svm %2,%1\n\t"
-#endif
"cvtqt/m %1,%0\n\t"
: "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
: "f"(new_x));
--
2.8.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes
2016-07-10 11:40 [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Aurelien Jarno
` (3 preceding siblings ...)
2016-07-10 11:57 ` [PATCH 1/4] alpha: fix ceil " Aurelien Jarno
@ 2016-07-22 3:36 ` Richard Henderson
2016-08-01 19:04 ` Matt Turner
5 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2016-07-22 3:36 UTC (permalink / raw)
To: Aurelien Jarno, libc-alpha
On 07/10/2016 05:09 PM, Aurelien Jarno wrote:
> The math testsuite recently got improved with some additional tests.
> Unfortunately they they fail on alpha. This patch series aim to fix
> the corresponding math functions.
>
> Aurelien Jarno (4):
> alpha: fix ceil on sNaN input
> alpha: fix floor on sNaN input
> alpha: fix rint on sNaN input
> alpha: fix trunc for big input values
>
Ok. Thanks.
r~
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes
2016-07-10 11:40 [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Aurelien Jarno
` (4 preceding siblings ...)
2016-07-22 3:36 ` [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Richard Henderson
@ 2016-08-01 19:04 ` Matt Turner
2016-08-01 21:20 ` Aurelien Jarno
5 siblings, 1 reply; 9+ messages in thread
From: Matt Turner @ 2016-08-01 19:04 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: GNU C Library
On Sun, Jul 10, 2016 at 4:39 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> The math testsuite recently got improved with some additional tests.
> Unfortunately they they fail on alpha. This patch series aim to fix
> the corresponding math functions.
>
> Aurelien Jarno (4):
> alpha: fix ceil on sNaN input
> alpha: fix floor on sNaN input
> alpha: fix rint on sNaN input
> alpha: fix trunc for big input values
Will you please push these?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes
2016-08-01 19:04 ` Matt Turner
@ 2016-08-01 21:20 ` Aurelien Jarno
2016-08-02 7:23 ` Aurelien Jarno
0 siblings, 1 reply; 9+ messages in thread
From: Aurelien Jarno @ 2016-08-01 21:20 UTC (permalink / raw)
To: Matt Turner; +Cc: GNU C Library
On 2016-08-01 12:04, Matt Turner wrote:
> On Sun, Jul 10, 2016 at 4:39 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > The math testsuite recently got improved with some additional tests.
> > Unfortunately they they fail on alpha. This patch series aim to fix
> > the corresponding math functions.
> >
> > Aurelien Jarno (4):
> > alpha: fix ceil on sNaN input
> > alpha: fix floor on sNaN input
> > alpha: fix rint on sNaN input
> > alpha: fix trunc for big input values
>
> Will you please push these?
Given we are in hard freeze, they should wait for 2.25.
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes
2016-08-01 21:20 ` Aurelien Jarno
@ 2016-08-02 7:23 ` Aurelien Jarno
0 siblings, 0 replies; 9+ messages in thread
From: Aurelien Jarno @ 2016-08-02 7:23 UTC (permalink / raw)
To: Matt Turner, GNU C Library
On 2016-08-01 23:20, Aurelien Jarno wrote:
> On 2016-08-01 12:04, Matt Turner wrote:
> > On Sun, Jul 10, 2016 at 4:39 AM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> > > The math testsuite recently got improved with some additional tests.
> > > Unfortunately they they fail on alpha. This patch series aim to fix
> > > the corresponding math functions.
> > >
> > > Aurelien Jarno (4):
> > > alpha: fix ceil on sNaN input
> > > alpha: fix floor on sNaN input
> > > alpha: fix rint on sNaN input
> > > alpha: fix trunc for big input values
> >
> > Will you please push these?
>
> Given we are in hard freeze, they should wait for 2.25.
I have just pushed the changes, they can be backported to the 2.24 branch
at some point if needed.
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-08-02 7:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-10 11:40 [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Aurelien Jarno
2016-07-10 11:40 ` [PATCH v2 4/4] alpha: fix trunc for big input values Aurelien Jarno
2016-07-10 11:40 ` [PATCH 3/4] alpha: fix rint on sNaN input Aurelien Jarno
2016-07-10 11:40 ` [PATCH 2/4] alpha: fix floor " Aurelien Jarno
2016-07-10 11:57 ` [PATCH 1/4] alpha: fix ceil " Aurelien Jarno
2016-07-22 3:36 ` [PATCH 0/4] alpha: fix math functions wrt recent testsuite changes Richard Henderson
2016-08-01 19:04 ` Matt Turner
2016-08-01 21:20 ` Aurelien Jarno
2016-08-02 7:23 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).