aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu/sp_sub.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/math-emu/sp_sub.c')
-rw-r--r--arch/mips/math-emu/sp_sub.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/arch/mips/math-emu/sp_sub.c b/arch/mips/math-emu/sp_sub.c
index 67a1f9e6bbfe..e813f4fee784 100644
--- a/arch/mips/math-emu/sp_sub.c
+++ b/arch/mips/math-emu/sp_sub.c
@@ -5,8 +5,6 @@
5 * MIPS floating point support 5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd. 6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 * 7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it 8 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as 9 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
@@ -18,16 +16,15 @@
18 * 16 *
19 * You should have received a copy of the GNU General Public License along 17 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc., 18 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 19 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 * ########################################################################
24 */ 20 */
25 21
26
27#include "ieee754sp.h" 22#include "ieee754sp.h"
28 23
29union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y) 24union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
30{ 25{
26 int s;
27
31 COMPXSP; 28 COMPXSP;
32 COMPYSP; 29 COMPYSP;
33 30
@@ -68,9 +65,9 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
68 return x; 65 return x;
69 66
70 67
71 /* Infinity handling 68 /*
72 */ 69 * Infinity handling
73 70 */
74 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): 71 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
75 if (xs != ys) 72 if (xs != ys)
76 return x; 73 return x;
@@ -87,15 +84,14 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
87 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM): 84 case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
88 return x; 85 return x;
89 86
90 /* Zero handling 87 /*
91 */ 88 * Zero handling
92 89 */
93 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): 90 case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO):
94 if (xs != ys) 91 if (xs != ys)
95 return x; 92 return x;
96 else 93 else
97 return ieee754sp_zero(ieee754_csr.rm == 94 return ieee754sp_zero(ieee754_csr.rm == IEEE754_RD);
98 IEEE754_RD);
99 95
100 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): 96 case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO):
101 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): 97 case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
@@ -133,14 +129,16 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y)
133 ym <<= 3; 129 ym <<= 3;
134 130
135 if (xe > ye) { 131 if (xe > ye) {
136 /* have to shift y fraction right to align 132 /*
133 * have to shift y fraction right to align
137 */ 134 */
138 int s = xe - ye; 135 s = xe - ye;
139 SPXSRSYn(s); 136 SPXSRSYn(s);
140 } else if (ye > xe) { 137 } else if (ye > xe) {
141 /* have to shift x fraction right to align 138 /*
139 * have to shift x fraction right to align
142 */ 140 */
143 int s = ye - xe; 141 s = ye - xe;
144 SPXSRSXn(s); 142 SPXSRSXn(s);
145 } 143 }
146 assert(xe == ye); 144 assert(xe == ye);