aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu/dp_sqrt.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2014-04-30 05:21:55 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-05-23 09:12:38 -0400
commit56a6473339dbd2e908cf8c6f2856d5de2bf8d15b (patch)
treea500f42c8e140cd909d0a5340474f6012c0740b4 /arch/mips/math-emu/dp_sqrt.c
parentaef3fb76aa1390ef864db888d06d8fcd5510df2d (diff)
MIPS: math-emu: Switch to using the MIPS rounding modes.
Previously math-emu was using the IEEE-754 constants internally. These were differing by having the constants for rounding to +/- infinity switched, so a conversion was necessary. This would be entirely avoidable if the MIPS constants were used throughout, so get rid of the bloat. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/math-emu/dp_sqrt.c')
-rw-r--r--arch/mips/math-emu/dp_sqrt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/mips/math-emu/dp_sqrt.c b/arch/mips/math-emu/dp_sqrt.c
index 0384c094b1aa..041bbb6124bb 100644
--- a/arch/mips/math-emu/dp_sqrt.c
+++ b/arch/mips/math-emu/dp_sqrt.c
@@ -80,7 +80,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
80 oldcsr = ieee754_csr; 80 oldcsr = ieee754_csr;
81 ieee754_csr.mx &= ~IEEE754_INEXACT; 81 ieee754_csr.mx &= ~IEEE754_INEXACT;
82 ieee754_csr.sx &= ~IEEE754_INEXACT; 82 ieee754_csr.sx &= ~IEEE754_INEXACT;
83 ieee754_csr.rm = IEEE754_RN; 83 ieee754_csr.rm = FPU_CSR_RN;
84 84
85 /* adjust exponent to prevent overflow */ 85 /* adjust exponent to prevent overflow */
86 scalx = 0; 86 scalx = 0;
@@ -122,7 +122,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
122 /* twiddle last bit to force y correctly rounded */ 122 /* twiddle last bit to force y correctly rounded */
123 123
124 /* set RZ, clear INEX flag */ 124 /* set RZ, clear INEX flag */
125 ieee754_csr.rm = IEEE754_RZ; 125 ieee754_csr.rm = FPU_CSR_RZ;
126 ieee754_csr.sx &= ~IEEE754_INEXACT; 126 ieee754_csr.sx &= ~IEEE754_INEXACT;
127 127
128 /* t=x/y; ...chopped quotient, possibly inexact */ 128 /* t=x/y; ...chopped quotient, possibly inexact */
@@ -139,10 +139,10 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x)
139 oldcsr.sx |= IEEE754_INEXACT; 139 oldcsr.sx |= IEEE754_INEXACT;
140 140
141 switch (oldcsr.rm) { 141 switch (oldcsr.rm) {
142 case IEEE754_RU: 142 case FPU_CSR_RU:
143 y.bits += 1; 143 y.bits += 1;
144 /* drop through */ 144 /* drop through */
145 case IEEE754_RN: 145 case FPU_CSR_RN:
146 t.bits += 1; 146 t.bits += 1;
147 break; 147 break;
148 } 148 }