From 2848b105856e49d98f3c5026b6d8d790f9723c0c Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Thu, 16 May 2013 23:33:55 +0100 Subject: MIPS: soft-fp NaN representation corrections [BZ #15442] This adds support for the inverse interpretation of the quiet bit of IEEE 754 floating-point NaN data that some processors use. This includes in particular MIPS architecture processors; the payload used for the canonical qNaN encoding is updated accordingly so as not to interfere with the quiet bit. --- ports/ChangeLog.aarch64 | 6 ++++++ ports/ChangeLog.alpha | 6 ++++++ ports/ChangeLog.mips | 14 ++++++++++++++ ports/ChangeLog.powerpc | 6 ++++++ ports/sysdeps/aarch64/soft-fp/sfp-machine.h | 2 ++ ports/sysdeps/alpha/soft-fp/sfp-machine.h | 1 + ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h | 8 +++++--- ports/sysdeps/mips/soft-fp/sfp-machine.h | 8 +++++--- ports/sysdeps/powerpc/soft-fp/sfp-machine.h | 1 + 9 files changed, 46 insertions(+), 6 deletions(-) (limited to 'ports') diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64 index a611ac2..a4fc296 100644 --- a/ports/ChangeLog.aarch64 +++ b/ports/ChangeLog.aarch64 @@ -1,3 +1,9 @@ +2013-05-16 Maciej W. Rozycki + + [BZ #15442] + * sysdeps/aarch64/soft-fp/sfp-machine.h (_FP_QNANNEGATEDP): New + macro. + 2013-05-12 Marcus Shawcroft * sysdeps/unix/sysv/linux/aarch64/clone.S (__clone): diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha index 9a77d27..3c16ce0 100644 --- a/ports/ChangeLog.alpha +++ b/ports/ChangeLog.alpha @@ -1,3 +1,9 @@ +2013-05-16 Maciej W. Rozycki + + [BZ #15442] + * sysdeps/alpha/soft-fp/sfp-machine.h (_FP_QNANNEGATEDP): New + macro. + 2013-03-06 Andreas Jaeger * sysdeps/unix/sysv/linux/alpha/bits/mman.h (MAP_HUGE_MASK) diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips index 472ae21..8640a12 100644 --- a/ports/ChangeLog.mips +++ b/ports/ChangeLog.mips @@ -1,3 +1,17 @@ +2013-05-16 Maciej W. Rozycki + + [BZ #15442] + * sysdeps/mips/mips64/soft-fp/sfp-machine.h (_FP_QNANNEGATEDP): + New macro. + (_FP_NANFRAC_S): Don't set the quiet bit. + (_FP_NANFRAC_D): Likewise. + (_FP_NANFRAC_Q): Likewise. + * sysdeps/mips/soft-fp/sfp-machine.h (_FP_QNANNEGATEDP): New + macro. + (_FP_NANFRAC_S): Don't set the quiet bit. + (_FP_NANFRAC_D): Likewise. + (_FP_NANFRAC_Q): Likewise. + 2013-05-16 Ryan S. Arnold * sysdeps/unix/sysv/linux/mips/kernel_rt_sigframe.h: Add missing diff --git a/ports/ChangeLog.powerpc b/ports/ChangeLog.powerpc index 2ba8e37..073df4f 100644 --- a/ports/ChangeLog.powerpc +++ b/ports/ChangeLog.powerpc @@ -1,3 +1,9 @@ +2013-05-16 Maciej W. Rozycki + + [BZ #15442] + * sysdeps/powerpc/soft-fp/sfp-machine.h (_FP_QNANNEGATEDP): New + macro. + 2013-02-28 Joseph Myers [BZ #13550] diff --git a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h index b355986..d21d00a 100644 --- a/ports/sysdeps/aarch64/soft-fp/sfp-machine.h +++ b/ports/sysdeps/aarch64/soft-fp/sfp-machine.h @@ -25,6 +25,8 @@ #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 +#define _FP_QNANNEGATEDP 0 + /* From my experiments it seems X is chosen unless one of the NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ diff --git a/ports/sysdeps/alpha/soft-fp/sfp-machine.h b/ports/sysdeps/alpha/soft-fp/sfp-machine.h index 343464c..be266fe 100644 --- a/ports/sysdeps/alpha/soft-fp/sfp-machine.h +++ b/ports/sysdeps/alpha/soft-fp/sfp-machine.h @@ -46,6 +46,7 @@ #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 +#define _FP_QNANNEGATEDP 0 /* Alpha Architecture Handbook, 4.7.10.4 sez that we should prefer any type of NaN in Fb, then Fa. */ diff --git a/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h index c81067d..1bdde5a 100644 --- a/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h +++ b/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h @@ -17,14 +17,16 @@ #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 +#define _FP_NANFRAC_S (_FP_QNANBIT_S - 1) +#define _FP_NANFRAC_D (_FP_QNANBIT_D - 1) +#define _FP_NANFRAC_Q (_FP_QNANBIT_Q - 1), -1 #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 +#define _FP_QNANNEGATEDP 1 + /* From my experiments it seems X is chosen unless one of the NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ diff --git a/ports/sysdeps/mips/soft-fp/sfp-machine.h b/ports/sysdeps/mips/soft-fp/sfp-machine.h index 3b2a40f..8ccfaa6 100644 --- a/ports/sysdeps/mips/soft-fp/sfp-machine.h +++ b/ports/sysdeps/mips/soft-fp/sfp-machine.h @@ -14,14 +14,16 @@ #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 +#define _FP_NANFRAC_S (_FP_QNANBIT_S - 1) +#define _FP_NANFRAC_D (_FP_QNANBIT_D - 1), -1 +#define _FP_NANFRAC_Q (_FP_QNANBIT_Q - 1), -1, -1, -1 #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 +#define _FP_QNANNEGATEDP 1 + /* From my experiments it seems X is chosen unless one of the NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ diff --git a/ports/sysdeps/powerpc/soft-fp/sfp-machine.h b/ports/sysdeps/powerpc/soft-fp/sfp-machine.h index 8a9afad..c2a190e 100644 --- a/ports/sysdeps/powerpc/soft-fp/sfp-machine.h +++ b/ports/sysdeps/powerpc/soft-fp/sfp-machine.h @@ -22,6 +22,7 @@ #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 +#define _FP_QNANNEGATEDP 0 /* Someone please check this. */ #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ -- cgit v1.1