diff options
Diffstat (limited to 'arch/mips/math-emu/dp_sub.c')
-rw-r--r-- | arch/mips/math-emu/dp_sub.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/arch/mips/math-emu/dp_sub.c b/arch/mips/math-emu/dp_sub.c index 3dd62c186767..d502984df7cc 100644 --- a/arch/mips/math-emu/dp_sub.c +++ b/arch/mips/math-emu/dp_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 "ieee754dp.h" | 22 | #include "ieee754dp.h" |
28 | 23 | ||
29 | union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) | 24 | union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) |
30 | { | 25 | { |
26 | int s; | ||
27 | |||
31 | COMPXDP; | 28 | COMPXDP; |
32 | COMPYDP; | 29 | COMPYDP; |
33 | 30 | ||
@@ -68,9 +65,9 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp 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 ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp 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 ieee754dp_zero(ieee754_csr.rm == | 94 | return ieee754dp_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): |
@@ -136,15 +132,17 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) | |||
136 | ym <<= 3; | 132 | ym <<= 3; |
137 | 133 | ||
138 | if (xe > ye) { | 134 | if (xe > ye) { |
139 | /* have to shift y fraction right to align | 135 | /* |
136 | * Have to shift y fraction right to align | ||
140 | */ | 137 | */ |
141 | int s = xe - ye; | 138 | s = xe - ye; |
142 | ym = XDPSRS(ym, s); | 139 | ym = XDPSRS(ym, s); |
143 | ye += s; | 140 | ye += s; |
144 | } else if (ye > xe) { | 141 | } else if (ye > xe) { |
145 | /* have to shift x fraction right to align | 142 | /* |
143 | * Have to shift x fraction right to align | ||
146 | */ | 144 | */ |
147 | int s = ye - xe; | 145 | s = ye - xe; |
148 | xm = XDPSRS(xm, s); | 146 | xm = XDPSRS(xm, s); |
149 | xe += s; | 147 | xe += s; |
150 | } | 148 | } |