aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2015-04-03 18:25:30 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-04-07 19:09:29 -0400
commit539bfb579babbe5a14b405370ecc99b4ed53bc4e (patch)
tree3ff8ef8e4a4d6796685b292f9a74f5fa1ecc7048 /arch/mips
parentd19cf86e2e295b0406b5fa3a35609fb0a99f1bde (diff)
MIPS: math-emu: Don't pass qNaNs through quieting handlers
Don't call the `ieee754sp_nanxcpt' and `ieee754dp_nanxcpt' sNaN quieting handlers for a qNaN supplied to floating-point format conversions or SQRT.S/SQRT.D instructions, or for a qNaN produced out of a negative operand supplied to SQRT.S/SQRT.D instructions. Return the qNaN right away in these cases. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9687/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/math-emu/dp_fsp.c2
-rw-r--r--arch/mips/math-emu/dp_sqrt.c6
-rw-r--r--arch/mips/math-emu/sp_fdp.c2
-rw-r--r--arch/mips/math-emu/sp_sqrt.c6
4 files changed, 8 insertions, 8 deletions
diff --git a/arch/mips/math-emu/dp_fsp.c b/arch/mips/math-emu/dp_fsp.c
index 88581f7e28dd..af48d2a277a4 100644
--- a/arch/mips/math-emu/dp_fsp.c
+++ b/arch/mips/math-emu/dp_fsp.c
@@ -44,7 +44,7 @@ union ieee754dp ieee754dp_fsp(union ieee754sp x)
44 return ieee754dp_nanxcpt(ieee754dp_indef()); 44 return ieee754dp_nanxcpt(ieee754dp_indef());
45 45
46 case IEEE754_CLASS_QNAN: 46 case IEEE754_CLASS_QNAN:
47 return ieee754dp_nanxcpt(ieee754dp_nan_fsp(xs, xm)); 47 return ieee754dp_nan_fsp(xs, xm);
48 48
49 case IEEE754_CLASS_INF: 49 case IEEE754_CLASS_INF:
50 return ieee754dp_inf(xs); 50 return ieee754dp_inf(xs);
diff --git a/arch/mips/math-emu/dp_sqrt.c b/arch/mips/math-emu/dp_sqrt.c
index 041bbb6124bb..0d8e7ffdba5e 100644
--- a/arch/mips/math-emu/dp_sqrt.c
+++ b/arch/mips/math-emu/dp_sqrt.c
@@ -44,7 +44,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
44 switch (xc) { 44 switch (xc) {
45 case IEEE754_CLASS_QNAN: 45 case IEEE754_CLASS_QNAN:
46 /* sqrt(Nan) = Nan */ 46 /* sqrt(Nan) = Nan */
47 return ieee754dp_nanxcpt(x); 47 return x;
48 48
49 case IEEE754_CLASS_SNAN: 49 case IEEE754_CLASS_SNAN:
50 ieee754_setcx(IEEE754_INVALID_OPERATION); 50 ieee754_setcx(IEEE754_INVALID_OPERATION);
@@ -58,7 +58,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
58 if (xs) { 58 if (xs) {
59 /* sqrt(-Inf) = Nan */ 59 /* sqrt(-Inf) = Nan */
60 ieee754_setcx(IEEE754_INVALID_OPERATION); 60 ieee754_setcx(IEEE754_INVALID_OPERATION);
61 return ieee754dp_nanxcpt(ieee754dp_indef()); 61 return ieee754dp_indef();
62 } 62 }
63 /* sqrt(+Inf) = Inf */ 63 /* sqrt(+Inf) = Inf */
64 return x; 64 return x;
@@ -71,7 +71,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
71 if (xs) { 71 if (xs) {
72 /* sqrt(-x) = Nan */ 72 /* sqrt(-x) = Nan */
73 ieee754_setcx(IEEE754_INVALID_OPERATION); 73 ieee754_setcx(IEEE754_INVALID_OPERATION);
74 return ieee754dp_nanxcpt(ieee754dp_indef()); 74 return ieee754dp_indef();
75 } 75 }
76 break; 76 break;
77 } 77 }
diff --git a/arch/mips/math-emu/sp_fdp.c b/arch/mips/math-emu/sp_fdp.c
index 4c0d0b4c4876..18a3f8c37136 100644
--- a/arch/mips/math-emu/sp_fdp.c
+++ b/arch/mips/math-emu/sp_fdp.c
@@ -50,7 +50,7 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x)
50 nan = ieee754sp_nan_fdp(xs, xm); 50 nan = ieee754sp_nan_fdp(xs, xm);
51 if (!ieee754sp_isnan(nan)) 51 if (!ieee754sp_isnan(nan))
52 nan = ieee754sp_indef(); 52 nan = ieee754sp_indef();
53 return ieee754sp_nanxcpt(nan); 53 return nan;
54 54
55 case IEEE754_CLASS_INF: 55 case IEEE754_CLASS_INF:
56 return ieee754sp_inf(xs); 56 return ieee754sp_inf(xs);
diff --git a/arch/mips/math-emu/sp_sqrt.c b/arch/mips/math-emu/sp_sqrt.c
index b7c098a86f95..9cc53effee62 100644
--- a/arch/mips/math-emu/sp_sqrt.c
+++ b/arch/mips/math-emu/sp_sqrt.c
@@ -37,7 +37,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
37 switch (xc) { 37 switch (xc) {
38 case IEEE754_CLASS_QNAN: 38 case IEEE754_CLASS_QNAN:
39 /* sqrt(Nan) = Nan */ 39 /* sqrt(Nan) = Nan */
40 return ieee754sp_nanxcpt(x); 40 return x;
41 41
42 case IEEE754_CLASS_SNAN: 42 case IEEE754_CLASS_SNAN:
43 ieee754_setcx(IEEE754_INVALID_OPERATION); 43 ieee754_setcx(IEEE754_INVALID_OPERATION);
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
51 if (xs) { 51 if (xs) {
52 /* sqrt(-Inf) = Nan */ 52 /* sqrt(-Inf) = Nan */
53 ieee754_setcx(IEEE754_INVALID_OPERATION); 53 ieee754_setcx(IEEE754_INVALID_OPERATION);
54 return ieee754sp_nanxcpt(ieee754sp_indef()); 54 return ieee754sp_indef();
55 } 55 }
56 /* sqrt(+Inf) = Inf */ 56 /* sqrt(+Inf) = Inf */
57 return x; 57 return x;
@@ -61,7 +61,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x)
61 if (xs) { 61 if (xs) {
62 /* sqrt(-x) = Nan */ 62 /* sqrt(-x) = Nan */
63 ieee754_setcx(IEEE754_INVALID_OPERATION); 63 ieee754_setcx(IEEE754_INVALID_OPERATION);
64 return ieee754sp_nanxcpt(ieee754sp_indef()); 64 return ieee754sp_indef();
65 } 65 }
66 break; 66 break;
67 } 67 }