aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu/sp_simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/math-emu/sp_simple.c')
-rw-r--r--arch/mips/math-emu/sp_simple.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index ae4fcfafd853..f1ffaa9a17e0 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.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,33 +16,17 @@
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
29int ieee754sp_finite(ieee754sp x) 24union ieee754sp ieee754sp_neg(union ieee754sp x)
30{
31 return SPBEXP(x) != SP_EMAX + 1 + SP_EBIAS;
32}
33
34ieee754sp ieee754sp_copysign(ieee754sp x, ieee754sp y)
35{
36 CLEARCX;
37 SPSIGN(x) = SPSIGN(y);
38 return x;
39}
40
41
42ieee754sp ieee754sp_neg(ieee754sp x)
43{ 25{
44 COMPXSP; 26 COMPXSP;
45 27
46 EXPLODEXSP; 28 EXPLODEXSP;
47 CLEARCX; 29 ieee754_clearcx();
48 FLUSHXSP; 30 FLUSHXSP;
49 31
50 /* 32 /*
@@ -55,30 +37,29 @@ ieee754sp ieee754sp_neg(ieee754sp x)
55 SPSIGN(x) ^= 1; 37 SPSIGN(x) ^= 1;
56 38
57 if (xc == IEEE754_CLASS_SNAN) { 39 if (xc == IEEE754_CLASS_SNAN) {
58 ieee754sp y = ieee754sp_indef(); 40 union ieee754sp y = ieee754sp_indef();
59 SETCX(IEEE754_INVALID_OPERATION); 41 ieee754_setcx(IEEE754_INVALID_OPERATION);
60 SPSIGN(y) = SPSIGN(x); 42 SPSIGN(y) = SPSIGN(x);
61 return ieee754sp_nanxcpt(y, "neg"); 43 return ieee754sp_nanxcpt(y);
62 } 44 }
63 45
64 return x; 46 return x;
65} 47}
66 48
67 49union ieee754sp ieee754sp_abs(union ieee754sp x)
68ieee754sp ieee754sp_abs(ieee754sp x)
69{ 50{
70 COMPXSP; 51 COMPXSP;
71 52
72 EXPLODEXSP; 53 EXPLODEXSP;
73 CLEARCX; 54 ieee754_clearcx();
74 FLUSHXSP; 55 FLUSHXSP;
75 56
76 /* Clear sign ALWAYS, irrespective of NaN */ 57 /* Clear sign ALWAYS, irrespective of NaN */
77 SPSIGN(x) = 0; 58 SPSIGN(x) = 0;
78 59
79 if (xc == IEEE754_CLASS_SNAN) { 60 if (xc == IEEE754_CLASS_SNAN) {
80 SETCX(IEEE754_INVALID_OPERATION); 61 ieee754_setcx(IEEE754_INVALID_OPERATION);
81 return ieee754sp_nanxcpt(ieee754sp_indef(), "abs"); 62 return ieee754sp_nanxcpt(ieee754sp_indef());
82 } 63 }
83 64
84 return x; 65 return x;