diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2014-04-30 05:21:55 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-05-23 09:12:38 -0400 |
commit | 56a6473339dbd2e908cf8c6f2856d5de2bf8d15b (patch) | |
tree | a500f42c8e140cd909d0a5340474f6012c0740b4 /arch/mips/math-emu/ieee754dp.c | |
parent | aef3fb76aa1390ef864db888d06d8fcd5510df2d (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/ieee754dp.c')
-rw-r--r-- | arch/mips/math-emu/ieee754dp.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c index 087a6f38b149..fd134675fc2e 100644 --- a/arch/mips/math-emu/ieee754dp.c +++ b/arch/mips/math-emu/ieee754dp.c | |||
@@ -67,17 +67,17 @@ static u64 ieee754dp_get_rounding(int sn, u64 xm) | |||
67 | */ | 67 | */ |
68 | if (xm & (DP_MBIT(3) - 1)) { | 68 | if (xm & (DP_MBIT(3) - 1)) { |
69 | switch (ieee754_csr.rm) { | 69 | switch (ieee754_csr.rm) { |
70 | case IEEE754_RZ: | 70 | case FPU_CSR_RZ: |
71 | break; | 71 | break; |
72 | case IEEE754_RN: | 72 | case FPU_CSR_RN: |
73 | xm += 0x3 + ((xm >> 3) & 1); | 73 | xm += 0x3 + ((xm >> 3) & 1); |
74 | /* xm += (xm&0x8)?0x4:0x3 */ | 74 | /* xm += (xm&0x8)?0x4:0x3 */ |
75 | break; | 75 | break; |
76 | case IEEE754_RU: /* toward +Infinity */ | 76 | case FPU_CSR_RU: /* toward +Infinity */ |
77 | if (!sn) /* ?? */ | 77 | if (!sn) /* ?? */ |
78 | xm += 0x8; | 78 | xm += 0x8; |
79 | break; | 79 | break; |
80 | case IEEE754_RD: /* toward -Infinity */ | 80 | case FPU_CSR_RD: /* toward -Infinity */ |
81 | if (sn) /* ?? */ | 81 | if (sn) /* ?? */ |
82 | xm += 0x8; | 82 | xm += 0x8; |
83 | break; | 83 | break; |
@@ -108,15 +108,15 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm) | |||
108 | ieee754_setcx(IEEE754_INEXACT); | 108 | ieee754_setcx(IEEE754_INEXACT); |
109 | 109 | ||
110 | switch(ieee754_csr.rm) { | 110 | switch(ieee754_csr.rm) { |
111 | case IEEE754_RN: | 111 | case FPU_CSR_RN: |
112 | case IEEE754_RZ: | 112 | case FPU_CSR_RZ: |
113 | return ieee754dp_zero(sn); | 113 | return ieee754dp_zero(sn); |
114 | case IEEE754_RU: /* toward +Infinity */ | 114 | case FPU_CSR_RU: /* toward +Infinity */ |
115 | if (sn == 0) | 115 | if (sn == 0) |
116 | return ieee754dp_min(0); | 116 | return ieee754dp_min(0); |
117 | else | 117 | else |
118 | return ieee754dp_zero(1); | 118 | return ieee754dp_zero(1); |
119 | case IEEE754_RD: /* toward -Infinity */ | 119 | case FPU_CSR_RD: /* toward -Infinity */ |
120 | if (sn == 0) | 120 | if (sn == 0) |
121 | return ieee754dp_zero(0); | 121 | return ieee754dp_zero(0); |
122 | else | 122 | else |
@@ -172,16 +172,16 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm) | |||
172 | ieee754_setcx(IEEE754_INEXACT); | 172 | ieee754_setcx(IEEE754_INEXACT); |
173 | /* -O can be table indexed by (rm,sn) */ | 173 | /* -O can be table indexed by (rm,sn) */ |
174 | switch (ieee754_csr.rm) { | 174 | switch (ieee754_csr.rm) { |
175 | case IEEE754_RN: | 175 | case FPU_CSR_RN: |
176 | return ieee754dp_inf(sn); | 176 | return ieee754dp_inf(sn); |
177 | case IEEE754_RZ: | 177 | case FPU_CSR_RZ: |
178 | return ieee754dp_max(sn); | 178 | return ieee754dp_max(sn); |
179 | case IEEE754_RU: /* toward +Infinity */ | 179 | case FPU_CSR_RU: /* toward +Infinity */ |
180 | if (sn == 0) | 180 | if (sn == 0) |
181 | return ieee754dp_inf(0); | 181 | return ieee754dp_inf(0); |
182 | else | 182 | else |
183 | return ieee754dp_max(1); | 183 | return ieee754dp_max(1); |
184 | case IEEE754_RD: /* toward -Infinity */ | 184 | case FPU_CSR_RD: /* toward -Infinity */ |
185 | if (sn == 0) | 185 | if (sn == 0) |
186 | return ieee754dp_max(0); | 186 | return ieee754dp_max(0); |
187 | else | 187 | else |