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/sysdeps/mips/mips64/soft-fp/sfp-machine.h | 8 +++++--- ports/sysdeps/mips/soft-fp/sfp-machine.h | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'ports/sysdeps/mips') diff --git a/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/ports/sysdeps/mips/mips64/soft-fp/sfp-machine.h index c81067dfd7..1bdde5ace8 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 3b2a40f0e2..8ccfaa60fd 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) \ -- cgit 1.4.1