diff options
Diffstat (limited to 'arch/mips/math-emu')
39 files changed, 143 insertions, 131 deletions
diff --git a/arch/mips/math-emu/dp_add.c b/arch/mips/math-emu/dp_add.c index b5aac129e9f1..7daaafcfeb78 100644 --- a/arch/mips/math-emu/dp_add.c +++ b/arch/mips/math-emu/dp_add.c | |||
@@ -35,7 +35,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y) | |||
35 | EXPLODEXDP; | 35 | EXPLODEXDP; |
36 | EXPLODEYDP; | 36 | EXPLODEYDP; |
37 | 37 | ||
38 | CLEARCX; | 38 | ieee754_clearcx(); |
39 | 39 | ||
40 | FLUSHXDP; | 40 | FLUSHXDP; |
41 | FLUSHYDP; | 41 | FLUSHYDP; |
@@ -52,7 +52,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y) | |||
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
54 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 54 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
55 | SETCX(IEEE754_INVALID_OPERATION); | 55 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
56 | return ieee754dp_nanxcpt(ieee754dp_indef(), "add", x, y); | 56 | return ieee754dp_nanxcpt(ieee754dp_indef(), "add", x, y); |
57 | 57 | ||
58 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 58 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -75,7 +75,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y) | |||
75 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): | 75 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): |
76 | if (xs == ys) | 76 | if (xs == ys) |
77 | return x; | 77 | return x; |
78 | SETCX(IEEE754_INVALID_OPERATION); | 78 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
79 | return ieee754dp_xcpt(ieee754dp_indef(), "add", x, y); | 79 | return ieee754dp_xcpt(ieee754dp_indef(), "add", x, y); |
80 | 80 | ||
81 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): | 81 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): |
diff --git a/arch/mips/math-emu/dp_cmp.c b/arch/mips/math-emu/dp_cmp.c index a3b4984d2e83..a8da7257a2e8 100644 --- a/arch/mips/math-emu/dp_cmp.c +++ b/arch/mips/math-emu/dp_cmp.c | |||
@@ -35,15 +35,15 @@ int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cmp, int sig) | |||
35 | EXPLODEYDP; | 35 | EXPLODEYDP; |
36 | FLUSHXDP; | 36 | FLUSHXDP; |
37 | FLUSHYDP; | 37 | FLUSHYDP; |
38 | CLEARCX; /* Even clear inexact flag here */ | 38 | ieee754_clearcx(); /* Even clear inexact flag here */ |
39 | 39 | ||
40 | if (ieee754dp_isnan(x) || ieee754dp_isnan(y)) { | 40 | if (ieee754dp_isnan(x) || ieee754dp_isnan(y)) { |
41 | if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN) | 41 | if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN) |
42 | SETCX(IEEE754_INVALID_OPERATION); | 42 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
43 | if (cmp & IEEE754_CUN) | 43 | if (cmp & IEEE754_CUN) |
44 | return 1; | 44 | return 1; |
45 | if (cmp & (IEEE754_CLT | IEEE754_CGT)) { | 45 | if (cmp & (IEEE754_CLT | IEEE754_CGT)) { |
46 | if (sig && SETANDTESTCX(IEEE754_INVALID_OPERATION)) | 46 | if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) |
47 | return ieee754si_xcpt(0, "fcmpf", x); | 47 | return ieee754si_xcpt(0, "fcmpf", x); |
48 | } | 48 | } |
49 | return 0; | 49 | return 0; |
diff --git a/arch/mips/math-emu/dp_div.c b/arch/mips/math-emu/dp_div.c index 30cc7fa3ce37..3b568b718d52 100644 --- a/arch/mips/math-emu/dp_div.c +++ b/arch/mips/math-emu/dp_div.c | |||
@@ -34,7 +34,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) | |||
34 | EXPLODEXDP; | 34 | EXPLODEXDP; |
35 | EXPLODEYDP; | 35 | EXPLODEYDP; |
36 | 36 | ||
37 | CLEARCX; | 37 | ieee754_clearcx(); |
38 | 38 | ||
39 | FLUSHXDP; | 39 | FLUSHXDP; |
40 | FLUSHYDP; | 40 | FLUSHYDP; |
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) | |||
51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "div", x, y); | 55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "div", x, y); |
56 | 56 | ||
57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -72,7 +72,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) | |||
72 | */ | 72 | */ |
73 | 73 | ||
74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): | 74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): |
75 | SETCX(IEEE754_INVALID_OPERATION); | 75 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
76 | return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y); | 76 | return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y); |
77 | 77 | ||
78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): | 78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): |
@@ -89,12 +89,12 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) | |||
89 | */ | 89 | */ |
90 | 90 | ||
91 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): | 91 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): |
92 | SETCX(IEEE754_INVALID_OPERATION); | 92 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
93 | return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y); | 93 | return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y); |
94 | 94 | ||
95 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): | 95 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): |
96 | case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): | 96 | case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): |
97 | SETCX(IEEE754_ZERO_DIVIDE); | 97 | ieee754_setcx(IEEE754_ZERO_DIVIDE); |
98 | return ieee754dp_xcpt(ieee754dp_inf(xs ^ ys), "div", x, y); | 98 | return ieee754dp_xcpt(ieee754dp_inf(xs ^ ys), "div", x, y); |
99 | 99 | ||
100 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): | 100 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): |
diff --git a/arch/mips/math-emu/dp_fint.c b/arch/mips/math-emu/dp_fint.c index 60ed6ec7ddc7..fa75f5dd5587 100644 --- a/arch/mips/math-emu/dp_fint.c +++ b/arch/mips/math-emu/dp_fint.c | |||
@@ -32,7 +32,7 @@ union ieee754dp ieee754dp_fint(int x) | |||
32 | int xe; | 32 | int xe; |
33 | int xs; | 33 | int xs; |
34 | 34 | ||
35 | CLEARCX; | 35 | ieee754_clearcx(); |
36 | 36 | ||
37 | if (x == 0) | 37 | if (x == 0) |
38 | return ieee754dp_zero(0); | 38 | return ieee754dp_zero(0); |
diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c index 2418f9d03055..89bd57917c94 100644 --- a/arch/mips/math-emu/dp_flong.c +++ b/arch/mips/math-emu/dp_flong.c | |||
@@ -32,7 +32,7 @@ union ieee754dp ieee754dp_flong(s64 x) | |||
32 | int xe; | 32 | int xe; |
33 | int xs; | 33 | int xs; |
34 | 34 | ||
35 | CLEARCX; | 35 | ieee754_clearcx(); |
36 | 36 | ||
37 | if (x == 0) | 37 | if (x == 0) |
38 | return ieee754dp_zero(0); | 38 | return ieee754dp_zero(0); |
diff --git a/arch/mips/math-emu/dp_frexp.c b/arch/mips/math-emu/dp_frexp.c index 6ab7df958362..25ebce16143e 100644 --- a/arch/mips/math-emu/dp_frexp.c +++ b/arch/mips/math-emu/dp_frexp.c | |||
@@ -31,7 +31,7 @@ | |||
31 | union ieee754dp ieee754dp_frexp(union ieee754dp x, int *eptr) | 31 | union ieee754dp ieee754dp_frexp(union ieee754dp x, int *eptr) |
32 | { | 32 | { |
33 | COMPXDP; | 33 | COMPXDP; |
34 | CLEARCX; | 34 | ieee754_clearcx(); |
35 | EXPLODEXDP; | 35 | EXPLODEXDP; |
36 | 36 | ||
37 | switch (xc) { | 37 | switch (xc) { |
diff --git a/arch/mips/math-emu/dp_fsp.c b/arch/mips/math-emu/dp_fsp.c index d69cb1ad3f60..cacd9f328690 100644 --- a/arch/mips/math-emu/dp_fsp.c +++ b/arch/mips/math-emu/dp_fsp.c | |||
@@ -32,13 +32,13 @@ union ieee754dp ieee754dp_fsp(union ieee754sp x) | |||
32 | 32 | ||
33 | EXPLODEXSP; | 33 | EXPLODEXSP; |
34 | 34 | ||
35 | CLEARCX; | 35 | ieee754_clearcx(); |
36 | 36 | ||
37 | FLUSHXSP; | 37 | FLUSHXSP; |
38 | 38 | ||
39 | switch (xc) { | 39 | switch (xc) { |
40 | case IEEE754_CLASS_SNAN: | 40 | case IEEE754_CLASS_SNAN: |
41 | SETCX(IEEE754_INVALID_OPERATION); | 41 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
42 | return ieee754dp_nanxcpt(ieee754dp_indef(), "fsp"); | 42 | return ieee754dp_nanxcpt(ieee754dp_indef(), "fsp"); |
43 | case IEEE754_CLASS_QNAN: | 43 | case IEEE754_CLASS_QNAN: |
44 | return ieee754dp_nanxcpt(builddp(xs, | 44 | return ieee754dp_nanxcpt(builddp(xs, |
diff --git a/arch/mips/math-emu/dp_logb.c b/arch/mips/math-emu/dp_logb.c index 80116e2f331f..b412c90355cd 100644 --- a/arch/mips/math-emu/dp_logb.c +++ b/arch/mips/math-emu/dp_logb.c | |||
@@ -30,7 +30,7 @@ union ieee754dp ieee754dp_logb(union ieee754dp x) | |||
30 | { | 30 | { |
31 | COMPXDP; | 31 | COMPXDP; |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXDP; | 35 | EXPLODEXDP; |
36 | 36 | ||
diff --git a/arch/mips/math-emu/dp_modf.c b/arch/mips/math-emu/dp_modf.c index cbc1386cdfca..61733ff512c7 100644 --- a/arch/mips/math-emu/dp_modf.c +++ b/arch/mips/math-emu/dp_modf.c | |||
@@ -32,7 +32,7 @@ union ieee754dp ieee754dp_modf(union ieee754dp x, union ieee754dp *ip) | |||
32 | { | 32 | { |
33 | COMPXDP; | 33 | COMPXDP; |
34 | 34 | ||
35 | CLEARCX; | 35 | ieee754_clearcx(); |
36 | 36 | ||
37 | EXPLODEXDP; | 37 | EXPLODEXDP; |
38 | 38 | ||
diff --git a/arch/mips/math-emu/dp_mul.c b/arch/mips/math-emu/dp_mul.c index c4cad69c377e..8f1bef91aa95 100644 --- a/arch/mips/math-emu/dp_mul.c +++ b/arch/mips/math-emu/dp_mul.c | |||
@@ -34,7 +34,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y) | |||
34 | EXPLODEXDP; | 34 | EXPLODEXDP; |
35 | EXPLODEYDP; | 35 | EXPLODEYDP; |
36 | 36 | ||
37 | CLEARCX; | 37 | ieee754_clearcx(); |
38 | 38 | ||
39 | FLUSHXDP; | 39 | FLUSHXDP; |
40 | FLUSHYDP; | 40 | FLUSHYDP; |
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y) | |||
51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "mul", x, y); | 55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "mul", x, y); |
56 | 56 | ||
57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -72,7 +72,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y) | |||
72 | 72 | ||
73 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): | 73 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): |
74 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): | 74 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): |
75 | SETCX(IEEE754_INVALID_OPERATION); | 75 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
76 | return ieee754dp_xcpt(ieee754dp_indef(), "mul", x, y); | 76 | return ieee754dp_xcpt(ieee754dp_indef(), "mul", x, y); |
77 | 77 | ||
78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): | 78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): |
diff --git a/arch/mips/math-emu/dp_scalb.c b/arch/mips/math-emu/dp_scalb.c index 4f8b65622942..dee37551fae1 100644 --- a/arch/mips/math-emu/dp_scalb.c +++ b/arch/mips/math-emu/dp_scalb.c | |||
@@ -30,7 +30,7 @@ union ieee754dp ieee754dp_scalb(union ieee754dp x, int n) | |||
30 | { | 30 | { |
31 | COMPXDP; | 31 | COMPXDP; |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXDP; | 35 | EXPLODEXDP; |
36 | 36 | ||
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c index b341cc83eeb0..c116502a00b7 100644 --- a/arch/mips/math-emu/dp_simple.c +++ b/arch/mips/math-emu/dp_simple.c | |||
@@ -33,7 +33,7 @@ int ieee754dp_finite(union ieee754dp x) | |||
33 | 33 | ||
34 | union ieee754dp ieee754dp_copysign(union ieee754dp x, union ieee754dp y) | 34 | union ieee754dp ieee754dp_copysign(union ieee754dp x, union ieee754dp y) |
35 | { | 35 | { |
36 | CLEARCX; | 36 | ieee754_clearcx(); |
37 | DPSIGN(x) = DPSIGN(y); | 37 | DPSIGN(x) = DPSIGN(y); |
38 | return x; | 38 | return x; |
39 | } | 39 | } |
@@ -44,7 +44,7 @@ union ieee754dp ieee754dp_neg(union ieee754dp x) | |||
44 | COMPXDP; | 44 | COMPXDP; |
45 | 45 | ||
46 | EXPLODEXDP; | 46 | EXPLODEXDP; |
47 | CLEARCX; | 47 | ieee754_clearcx(); |
48 | FLUSHXDP; | 48 | FLUSHXDP; |
49 | 49 | ||
50 | /* | 50 | /* |
@@ -56,7 +56,7 @@ union ieee754dp ieee754dp_neg(union ieee754dp x) | |||
56 | 56 | ||
57 | if (xc == IEEE754_CLASS_SNAN) { | 57 | if (xc == IEEE754_CLASS_SNAN) { |
58 | union ieee754dp y = ieee754dp_indef(); | 58 | union ieee754dp y = ieee754dp_indef(); |
59 | SETCX(IEEE754_INVALID_OPERATION); | 59 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
60 | DPSIGN(y) = DPSIGN(x); | 60 | DPSIGN(y) = DPSIGN(x); |
61 | return ieee754dp_nanxcpt(y, "neg"); | 61 | return ieee754dp_nanxcpt(y, "neg"); |
62 | } | 62 | } |
@@ -70,14 +70,14 @@ union ieee754dp ieee754dp_abs(union ieee754dp x) | |||
70 | COMPXDP; | 70 | COMPXDP; |
71 | 71 | ||
72 | EXPLODEXDP; | 72 | EXPLODEXDP; |
73 | CLEARCX; | 73 | ieee754_clearcx(); |
74 | FLUSHXDP; | 74 | FLUSHXDP; |
75 | 75 | ||
76 | /* Clear sign ALWAYS, irrespective of NaN */ | 76 | /* Clear sign ALWAYS, irrespective of NaN */ |
77 | DPSIGN(x) = 0; | 77 | DPSIGN(x) = 0; |
78 | 78 | ||
79 | if (xc == IEEE754_CLASS_SNAN) { | 79 | if (xc == IEEE754_CLASS_SNAN) { |
80 | SETCX(IEEE754_INVALID_OPERATION); | 80 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
81 | return ieee754dp_nanxcpt(ieee754dp_indef(), "abs"); | 81 | return ieee754dp_nanxcpt(ieee754dp_indef(), "abs"); |
82 | } | 82 | } |
83 | 83 | ||
diff --git a/arch/mips/math-emu/dp_sqrt.c b/arch/mips/math-emu/dp_sqrt.c index cee9f3c2700d..1e0fbbf56e97 100644 --- a/arch/mips/math-emu/dp_sqrt.c +++ b/arch/mips/math-emu/dp_sqrt.c | |||
@@ -42,7 +42,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x) | |||
42 | COMPXDP; | 42 | COMPXDP; |
43 | 43 | ||
44 | EXPLODEXDP; | 44 | EXPLODEXDP; |
45 | CLEARCX; | 45 | ieee754_clearcx(); |
46 | FLUSHXDP; | 46 | FLUSHXDP; |
47 | 47 | ||
48 | /* x == INF or NAN? */ | 48 | /* x == INF or NAN? */ |
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x) | |||
51 | /* sqrt(Nan) = Nan */ | 51 | /* sqrt(Nan) = Nan */ |
52 | return ieee754dp_nanxcpt(x, "sqrt"); | 52 | return ieee754dp_nanxcpt(x, "sqrt"); |
53 | case IEEE754_CLASS_SNAN: | 53 | case IEEE754_CLASS_SNAN: |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); | 55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); |
56 | case IEEE754_CLASS_ZERO: | 56 | case IEEE754_CLASS_ZERO: |
57 | /* sqrt(0) = 0 */ | 57 | /* sqrt(0) = 0 */ |
@@ -59,7 +59,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x) | |||
59 | case IEEE754_CLASS_INF: | 59 | case IEEE754_CLASS_INF: |
60 | if (xs) { | 60 | if (xs) { |
61 | /* sqrt(-Inf) = Nan */ | 61 | /* sqrt(-Inf) = Nan */ |
62 | SETCX(IEEE754_INVALID_OPERATION); | 62 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
63 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); | 63 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); |
64 | } | 64 | } |
65 | /* sqrt(+Inf) = Inf */ | 65 | /* sqrt(+Inf) = Inf */ |
@@ -70,7 +70,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x) | |||
70 | case IEEE754_CLASS_NORM: | 70 | case IEEE754_CLASS_NORM: |
71 | if (xs) { | 71 | if (xs) { |
72 | /* sqrt(-x) = Nan */ | 72 | /* sqrt(-x) = Nan */ |
73 | SETCX(IEEE754_INVALID_OPERATION); | 73 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
74 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); | 74 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); |
75 | } | 75 | } |
76 | break; | 76 | break; |
diff --git a/arch/mips/math-emu/dp_sub.c b/arch/mips/math-emu/dp_sub.c index 1e8f19ae6cd5..e369c7b07f5e 100644 --- a/arch/mips/math-emu/dp_sub.c +++ b/arch/mips/math-emu/dp_sub.c | |||
@@ -34,7 +34,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) | |||
34 | EXPLODEXDP; | 34 | EXPLODEXDP; |
35 | EXPLODEYDP; | 35 | EXPLODEYDP; |
36 | 36 | ||
37 | CLEARCX; | 37 | ieee754_clearcx(); |
38 | 38 | ||
39 | FLUSHXDP; | 39 | FLUSHXDP; |
40 | FLUSHYDP; | 40 | FLUSHYDP; |
@@ -51,7 +51,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) | |||
51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sub", x, y); | 55 | return ieee754dp_nanxcpt(ieee754dp_indef(), "sub", x, y); |
56 | 56 | ||
57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -74,7 +74,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) | |||
74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): | 74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): |
75 | if (xs != ys) | 75 | if (xs != ys) |
76 | return x; | 76 | return x; |
77 | SETCX(IEEE754_INVALID_OPERATION); | 77 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
78 | return ieee754dp_xcpt(ieee754dp_indef(), "sub", x, y); | 78 | return ieee754dp_xcpt(ieee754dp_indef(), "sub", x, y); |
79 | 79 | ||
80 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): | 80 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): |
diff --git a/arch/mips/math-emu/dp_tint.c b/arch/mips/math-emu/dp_tint.c index e6bc33fd61a9..792470c53779 100644 --- a/arch/mips/math-emu/dp_tint.c +++ b/arch/mips/math-emu/dp_tint.c | |||
@@ -30,7 +30,7 @@ int ieee754dp_tint(union ieee754dp x) | |||
30 | { | 30 | { |
31 | COMPXDP; | 31 | COMPXDP; |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXDP; | 35 | EXPLODEXDP; |
36 | FLUSHXDP; | 36 | FLUSHXDP; |
@@ -39,7 +39,7 @@ int ieee754dp_tint(union ieee754dp x) | |||
39 | case IEEE754_CLASS_SNAN: | 39 | case IEEE754_CLASS_SNAN: |
40 | case IEEE754_CLASS_QNAN: | 40 | case IEEE754_CLASS_QNAN: |
41 | case IEEE754_CLASS_INF: | 41 | case IEEE754_CLASS_INF: |
42 | SETCX(IEEE754_INVALID_OPERATION); | 42 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
43 | return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); | 43 | return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); |
44 | case IEEE754_CLASS_ZERO: | 44 | case IEEE754_CLASS_ZERO: |
45 | return 0; | 45 | return 0; |
@@ -50,7 +50,7 @@ int ieee754dp_tint(union ieee754dp x) | |||
50 | if (xe > 31) { | 50 | if (xe > 31) { |
51 | /* Set invalid. We will only use overflow for floating | 51 | /* Set invalid. We will only use overflow for floating |
52 | point overflow */ | 52 | point overflow */ |
53 | SETCX(IEEE754_INVALID_OPERATION); | 53 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
54 | return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); | 54 | return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); |
55 | } | 55 | } |
56 | /* oh gawd */ | 56 | /* oh gawd */ |
@@ -95,11 +95,11 @@ int ieee754dp_tint(union ieee754dp x) | |||
95 | /* look for valid corner case 0x80000000 */ | 95 | /* look for valid corner case 0x80000000 */ |
96 | if ((xm >> 31) != 0 && (xs == 0 || xm != 0x80000000)) { | 96 | if ((xm >> 31) != 0 && (xs == 0 || xm != 0x80000000)) { |
97 | /* This can happen after rounding */ | 97 | /* This can happen after rounding */ |
98 | SETCX(IEEE754_INVALID_OPERATION); | 98 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
99 | return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); | 99 | return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); |
100 | } | 100 | } |
101 | if (round || sticky) | 101 | if (round || sticky) |
102 | SETCX(IEEE754_INEXACT); | 102 | ieee754_setcx(IEEE754_INEXACT); |
103 | } | 103 | } |
104 | if (xs) | 104 | if (xs) |
105 | return -xm; | 105 | return -xm; |
diff --git a/arch/mips/math-emu/dp_tlong.c b/arch/mips/math-emu/dp_tlong.c index 3366399eebe8..fcc1c4f50e98 100644 --- a/arch/mips/math-emu/dp_tlong.c +++ b/arch/mips/math-emu/dp_tlong.c | |||
@@ -30,7 +30,7 @@ s64 ieee754dp_tlong(union ieee754dp x) | |||
30 | { | 30 | { |
31 | COMPXDP; | 31 | COMPXDP; |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXDP; | 35 | EXPLODEXDP; |
36 | FLUSHXDP; | 36 | FLUSHXDP; |
@@ -39,7 +39,7 @@ s64 ieee754dp_tlong(union ieee754dp x) | |||
39 | case IEEE754_CLASS_SNAN: | 39 | case IEEE754_CLASS_SNAN: |
40 | case IEEE754_CLASS_QNAN: | 40 | case IEEE754_CLASS_QNAN: |
41 | case IEEE754_CLASS_INF: | 41 | case IEEE754_CLASS_INF: |
42 | SETCX(IEEE754_INVALID_OPERATION); | 42 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
43 | return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); | 43 | return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); |
44 | case IEEE754_CLASS_ZERO: | 44 | case IEEE754_CLASS_ZERO: |
45 | return 0; | 45 | return 0; |
@@ -53,7 +53,7 @@ s64 ieee754dp_tlong(union ieee754dp x) | |||
53 | return -0x8000000000000000LL; | 53 | return -0x8000000000000000LL; |
54 | /* Set invalid. We will only use overflow for floating | 54 | /* Set invalid. We will only use overflow for floating |
55 | point overflow */ | 55 | point overflow */ |
56 | SETCX(IEEE754_INVALID_OPERATION); | 56 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
57 | return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); | 57 | return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); |
58 | } | 58 | } |
59 | /* oh gawd */ | 59 | /* oh gawd */ |
@@ -99,11 +99,11 @@ s64 ieee754dp_tlong(union ieee754dp x) | |||
99 | } | 99 | } |
100 | if ((xm >> 63) != 0) { | 100 | if ((xm >> 63) != 0) { |
101 | /* This can happen after rounding */ | 101 | /* This can happen after rounding */ |
102 | SETCX(IEEE754_INVALID_OPERATION); | 102 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
103 | return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); | 103 | return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); |
104 | } | 104 | } |
105 | if (round || sticky) | 105 | if (round || sticky) |
106 | SETCX(IEEE754_INEXACT); | 106 | ieee754_setcx(IEEE754_INEXACT); |
107 | } | 107 | } |
108 | if (xs) | 108 | if (xs) |
109 | return -xm; | 109 | return -xm; |
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c index 141f0cb40df4..26f785edb60c 100644 --- a/arch/mips/math-emu/ieee754.c +++ b/arch/mips/math-emu/ieee754.c | |||
@@ -101,7 +101,7 @@ int __cold ieee754si_xcpt(int r, const char *op, ...) | |||
101 | { | 101 | { |
102 | struct ieee754xctx ax; | 102 | struct ieee754xctx ax; |
103 | 103 | ||
104 | if (!TSTX()) | 104 | if (!ieee754_tstx()) |
105 | return r; | 105 | return r; |
106 | ax.op = op; | 106 | ax.op = op; |
107 | ax.rt = IEEE754_RT_SI; | 107 | ax.rt = IEEE754_RT_SI; |
@@ -116,7 +116,7 @@ s64 __cold ieee754di_xcpt(s64 r, const char *op, ...) | |||
116 | { | 116 | { |
117 | struct ieee754xctx ax; | 117 | struct ieee754xctx ax; |
118 | 118 | ||
119 | if (!TSTX()) | 119 | if (!ieee754_tstx()) |
120 | return r; | 120 | return r; |
121 | ax.op = op; | 121 | ax.op = op; |
122 | ax.rt = IEEE754_RT_DI; | 122 | ax.rt = IEEE754_RT_DI; |
diff --git a/arch/mips/math-emu/ieee754.h b/arch/mips/math-emu/ieee754.h index 05705fa785c3..a1970894094b 100644 --- a/arch/mips/math-emu/ieee754.h +++ b/arch/mips/math-emu/ieee754.h | |||
@@ -170,12 +170,14 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x); | |||
170 | 170 | ||
171 | /* 5 types of floating point number | 171 | /* 5 types of floating point number |
172 | */ | 172 | */ |
173 | #define IEEE754_CLASS_NORM 0x00 | 173 | enum { |
174 | #define IEEE754_CLASS_ZERO 0x01 | 174 | IEEE754_CLASS_NORM = 0x00, |
175 | #define IEEE754_CLASS_DNORM 0x02 | 175 | IEEE754_CLASS_ZERO = 0x01, |
176 | #define IEEE754_CLASS_INF 0x03 | 176 | IEEE754_CLASS_DNORM = 0x02, |
177 | #define IEEE754_CLASS_SNAN 0x04 | 177 | IEEE754_CLASS_INF = 0x03, |
178 | #define IEEE754_CLASS_QNAN 0x05 | 178 | IEEE754_CLASS_SNAN = 0x04, |
179 | IEEE754_CLASS_QNAN = 0x05, | ||
180 | }; | ||
179 | 181 | ||
180 | /* exception numbers */ | 182 | /* exception numbers */ |
181 | #define IEEE754_INEXACT 0x01 | 183 | #define IEEE754_INEXACT 0x01 |
diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c index 43fb7fefb6cc..53dbb1cb52a9 100644 --- a/arch/mips/math-emu/ieee754dp.c +++ b/arch/mips/math-emu/ieee754dp.c | |||
@@ -49,7 +49,7 @@ int ieee754dp_issnan(union ieee754dp x) | |||
49 | union ieee754dp __cold ieee754dp_xcpt(union ieee754dp r, const char *op, ...) | 49 | union ieee754dp __cold ieee754dp_xcpt(union ieee754dp r, const char *op, ...) |
50 | { | 50 | { |
51 | struct ieee754xctx ax; | 51 | struct ieee754xctx ax; |
52 | if (!TSTX()) | 52 | if (!ieee754_tstx()) |
53 | return r; | 53 | return r; |
54 | 54 | ||
55 | ax.op = op; | 55 | ax.op = op; |
@@ -70,7 +70,7 @@ union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp r, const char *op, ...) | |||
70 | if (!ieee754dp_issnan(r)) /* QNAN does not cause invalid op !! */ | 70 | if (!ieee754dp_issnan(r)) /* QNAN does not cause invalid op !! */ |
71 | return r; | 71 | return r; |
72 | 72 | ||
73 | if (!SETANDTESTCX(IEEE754_INVALID_OPERATION)) { | 73 | if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) { |
74 | /* not enabled convert to a quiet NaN */ | 74 | /* not enabled convert to a quiet NaN */ |
75 | DPMANT(r) &= (~DP_MBIT(DP_MBITS-1)); | 75 | DPMANT(r) &= (~DP_MBIT(DP_MBITS-1)); |
76 | if (ieee754dp_isnan(r)) | 76 | if (ieee754dp_isnan(r)) |
@@ -143,8 +143,8 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm) | |||
143 | int es = DP_EMIN - xe; | 143 | int es = DP_EMIN - xe; |
144 | 144 | ||
145 | if (ieee754_csr.nod) { | 145 | if (ieee754_csr.nod) { |
146 | SETCX(IEEE754_UNDERFLOW); | 146 | ieee754_setcx(IEEE754_UNDERFLOW); |
147 | SETCX(IEEE754_INEXACT); | 147 | ieee754_setcx(IEEE754_INEXACT); |
148 | 148 | ||
149 | switch(ieee754_csr.rm) { | 149 | switch(ieee754_csr.rm) { |
150 | case IEEE754_RN: | 150 | case IEEE754_RN: |
@@ -167,7 +167,7 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm) | |||
167 | && get_rounding(sn, xm) >> (DP_MBITS + 1 + 3)) | 167 | && get_rounding(sn, xm) >> (DP_MBITS + 1 + 3)) |
168 | { | 168 | { |
169 | /* Not tiny after rounding */ | 169 | /* Not tiny after rounding */ |
170 | SETCX(IEEE754_INEXACT); | 170 | ieee754_setcx(IEEE754_INEXACT); |
171 | xm = get_rounding(sn, xm); | 171 | xm = get_rounding(sn, xm); |
172 | xm >>= 1; | 172 | xm >>= 1; |
173 | /* Clear grs bits */ | 173 | /* Clear grs bits */ |
@@ -184,9 +184,9 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm) | |||
184 | } | 184 | } |
185 | } | 185 | } |
186 | if (xm & (DP_MBIT(3) - 1)) { | 186 | if (xm & (DP_MBIT(3) - 1)) { |
187 | SETCX(IEEE754_INEXACT); | 187 | ieee754_setcx(IEEE754_INEXACT); |
188 | if ((xm & (DP_HIDDEN_BIT << 3)) == 0) { | 188 | if ((xm & (DP_HIDDEN_BIT << 3)) == 0) { |
189 | SETCX(IEEE754_UNDERFLOW); | 189 | ieee754_setcx(IEEE754_UNDERFLOW); |
190 | } | 190 | } |
191 | 191 | ||
192 | /* inexact must round of 3 bits | 192 | /* inexact must round of 3 bits |
@@ -207,8 +207,8 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm) | |||
207 | assert(xe >= DP_EMIN); | 207 | assert(xe >= DP_EMIN); |
208 | 208 | ||
209 | if (xe > DP_EMAX) { | 209 | if (xe > DP_EMAX) { |
210 | SETCX(IEEE754_OVERFLOW); | 210 | ieee754_setcx(IEEE754_OVERFLOW); |
211 | SETCX(IEEE754_INEXACT); | 211 | ieee754_setcx(IEEE754_INEXACT); |
212 | /* -O can be table indexed by (rm,sn) */ | 212 | /* -O can be table indexed by (rm,sn) */ |
213 | switch (ieee754_csr.rm) { | 213 | switch (ieee754_csr.rm) { |
214 | case IEEE754_RN: | 214 | case IEEE754_RN: |
@@ -233,7 +233,7 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm) | |||
233 | /* we underflow (tiny/zero) */ | 233 | /* we underflow (tiny/zero) */ |
234 | assert(xe == DP_EMIN); | 234 | assert(xe == DP_EMIN); |
235 | if (ieee754_csr.mx & IEEE754_UNDERFLOW) | 235 | if (ieee754_csr.mx & IEEE754_UNDERFLOW) |
236 | SETCX(IEEE754_UNDERFLOW); | 236 | ieee754_setcx(IEEE754_UNDERFLOW); |
237 | return builddp(sn, DP_EMIN - 1 + DP_EBIAS, xm); | 237 | return builddp(sn, DP_EMIN - 1 + DP_EBIAS, xm); |
238 | } else { | 238 | } else { |
239 | assert((xm >> (DP_MBITS + 1)) == 0); /* no execess */ | 239 | assert((xm >> (DP_MBITS + 1)) == 0); /* no execess */ |
diff --git a/arch/mips/math-emu/ieee754dp.h b/arch/mips/math-emu/ieee754dp.h index 3759f3f35293..1dc205880cba 100644 --- a/arch/mips/math-emu/ieee754dp.h +++ b/arch/mips/math-emu/ieee754dp.h | |||
@@ -74,7 +74,7 @@ extern union ieee754dp ieee754dp_format(int, int, u64); | |||
74 | #define DPNORMRET2(s, e, m, name, a0, a1) \ | 74 | #define DPNORMRET2(s, e, m, name, a0, a1) \ |
75 | { \ | 75 | { \ |
76 | union ieee754dp V = ieee754dp_format(s, e, m); \ | 76 | union ieee754dp V = ieee754dp_format(s, e, m); \ |
77 | if (TSTX()) \ | 77 | if (ieee754_tstx()) \ |
78 | return ieee754dp_xcpt(V, name, a0, a1); \ | 78 | return ieee754dp_xcpt(V, name, a0, a1); \ |
79 | else \ | 79 | else \ |
80 | return V; \ | 80 | return V; \ |
diff --git a/arch/mips/math-emu/ieee754int.h b/arch/mips/math-emu/ieee754int.h index 62d0fdbdb44e..39c40d275825 100644 --- a/arch/mips/math-emu/ieee754int.h +++ b/arch/mips/math-emu/ieee754int.h | |||
@@ -57,18 +57,28 @@ | |||
57 | 57 | ||
58 | #define CLPAIR(x, y) ((x)*6+(y)) | 58 | #define CLPAIR(x, y) ((x)*6+(y)) |
59 | 59 | ||
60 | #define CLEARCX \ | 60 | static inline void ieee754_clearcx(void) |
61 | (ieee754_csr.cx = 0) | 61 | { |
62 | ieee754_csr.cx = 0; | ||
63 | } | ||
62 | 64 | ||
63 | #define SETCX(x) \ | 65 | static inline void ieee754_setcx(const unsigned int flags) |
64 | (ieee754_csr.cx |= (x), ieee754_csr.sx |= (x)) | 66 | { |
67 | ieee754_csr.cx |= flags; | ||
68 | ieee754_csr.sx |= flags; | ||
69 | } | ||
65 | 70 | ||
66 | #define SETANDTESTCX(x) \ | 71 | static inline int ieee754_setandtestcx(const unsigned int x) |
67 | (SETCX(x), ieee754_csr.mx & (x)) | 72 | { |
73 | ieee754_setcx(x); | ||
68 | 74 | ||
69 | #define TSTX() \ | 75 | return ieee754_csr.mx & x; |
70 | (ieee754_csr.cx & ieee754_csr.mx) | 76 | } |
71 | 77 | ||
78 | static inline int ieee754_tstx(void) | ||
79 | { | ||
80 | return ieee754_csr.cx & ieee754_csr.mx; | ||
81 | } | ||
72 | 82 | ||
73 | #define COMPXSP \ | 83 | #define COMPXSP \ |
74 | unsigned xm; int xe; int xs __maybe_unused; int xc | 84 | unsigned xm; int xe; int xs __maybe_unused; int xc |
@@ -140,7 +150,7 @@ | |||
140 | #define FLUSHDP(v, vc, vs, ve, vm) \ | 150 | #define FLUSHDP(v, vc, vs, ve, vm) \ |
141 | if (vc==IEEE754_CLASS_DNORM) { \ | 151 | if (vc==IEEE754_CLASS_DNORM) { \ |
142 | if (ieee754_csr.nod) { \ | 152 | if (ieee754_csr.nod) { \ |
143 | SETCX(IEEE754_INEXACT); \ | 153 | ieee754_setcx(IEEE754_INEXACT); \ |
144 | vc = IEEE754_CLASS_ZERO; \ | 154 | vc = IEEE754_CLASS_ZERO; \ |
145 | ve = DP_EMIN-1+DP_EBIAS; \ | 155 | ve = DP_EMIN-1+DP_EBIAS; \ |
146 | vm = 0; \ | 156 | vm = 0; \ |
@@ -151,7 +161,7 @@ | |||
151 | #define FLUSHSP(v, vc, vs, ve, vm) \ | 161 | #define FLUSHSP(v, vc, vs, ve, vm) \ |
152 | if (vc==IEEE754_CLASS_DNORM) { \ | 162 | if (vc==IEEE754_CLASS_DNORM) { \ |
153 | if (ieee754_csr.nod) { \ | 163 | if (ieee754_csr.nod) { \ |
154 | SETCX(IEEE754_INEXACT); \ | 164 | ieee754_setcx(IEEE754_INEXACT); \ |
155 | vc = IEEE754_CLASS_ZERO; \ | 165 | vc = IEEE754_CLASS_ZERO; \ |
156 | ve = SP_EMIN-1+SP_EBIAS; \ | 166 | ve = SP_EMIN-1+SP_EBIAS; \ |
157 | vm = 0; \ | 167 | vm = 0; \ |
diff --git a/arch/mips/math-emu/ieee754sp.c b/arch/mips/math-emu/ieee754sp.c index a15d2123e05e..955e474b5b59 100644 --- a/arch/mips/math-emu/ieee754sp.c +++ b/arch/mips/math-emu/ieee754sp.c | |||
@@ -50,7 +50,7 @@ union ieee754sp __cold ieee754sp_xcpt(union ieee754sp r, const char *op, ...) | |||
50 | { | 50 | { |
51 | struct ieee754xctx ax; | 51 | struct ieee754xctx ax; |
52 | 52 | ||
53 | if (!TSTX()) | 53 | if (!ieee754_tstx()) |
54 | return r; | 54 | return r; |
55 | 55 | ||
56 | ax.op = op; | 56 | ax.op = op; |
@@ -71,7 +71,7 @@ union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp r, const char *op, ...) | |||
71 | if (!ieee754sp_issnan(r)) /* QNAN does not cause invalid op !! */ | 71 | if (!ieee754sp_issnan(r)) /* QNAN does not cause invalid op !! */ |
72 | return r; | 72 | return r; |
73 | 73 | ||
74 | if (!SETANDTESTCX(IEEE754_INVALID_OPERATION)) { | 74 | if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) { |
75 | /* not enabled convert to a quiet NaN */ | 75 | /* not enabled convert to a quiet NaN */ |
76 | SPMANT(r) &= (~SP_MBIT(SP_MBITS-1)); | 76 | SPMANT(r) &= (~SP_MBIT(SP_MBITS-1)); |
77 | if (ieee754sp_isnan(r)) | 77 | if (ieee754sp_isnan(r)) |
@@ -144,8 +144,8 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm) | |||
144 | int es = SP_EMIN - xe; | 144 | int es = SP_EMIN - xe; |
145 | 145 | ||
146 | if (ieee754_csr.nod) { | 146 | if (ieee754_csr.nod) { |
147 | SETCX(IEEE754_UNDERFLOW); | 147 | ieee754_setcx(IEEE754_UNDERFLOW); |
148 | SETCX(IEEE754_INEXACT); | 148 | ieee754_setcx(IEEE754_INEXACT); |
149 | 149 | ||
150 | switch(ieee754_csr.rm) { | 150 | switch(ieee754_csr.rm) { |
151 | case IEEE754_RN: | 151 | case IEEE754_RN: |
@@ -168,7 +168,7 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm) | |||
168 | && get_rounding(sn, xm) >> (SP_MBITS + 1 + 3)) | 168 | && get_rounding(sn, xm) >> (SP_MBITS + 1 + 3)) |
169 | { | 169 | { |
170 | /* Not tiny after rounding */ | 170 | /* Not tiny after rounding */ |
171 | SETCX(IEEE754_INEXACT); | 171 | ieee754_setcx(IEEE754_INEXACT); |
172 | xm = get_rounding(sn, xm); | 172 | xm = get_rounding(sn, xm); |
173 | xm >>= 1; | 173 | xm >>= 1; |
174 | /* Clear grs bits */ | 174 | /* Clear grs bits */ |
@@ -183,9 +183,9 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm) | |||
183 | } | 183 | } |
184 | } | 184 | } |
185 | if (xm & (SP_MBIT(3) - 1)) { | 185 | if (xm & (SP_MBIT(3) - 1)) { |
186 | SETCX(IEEE754_INEXACT); | 186 | ieee754_setcx(IEEE754_INEXACT); |
187 | if ((xm & (SP_HIDDEN_BIT << 3)) == 0) { | 187 | if ((xm & (SP_HIDDEN_BIT << 3)) == 0) { |
188 | SETCX(IEEE754_UNDERFLOW); | 188 | ieee754_setcx(IEEE754_UNDERFLOW); |
189 | } | 189 | } |
190 | 190 | ||
191 | /* inexact must round of 3 bits | 191 | /* inexact must round of 3 bits |
@@ -206,8 +206,8 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm) | |||
206 | assert(xe >= SP_EMIN); | 206 | assert(xe >= SP_EMIN); |
207 | 207 | ||
208 | if (xe > SP_EMAX) { | 208 | if (xe > SP_EMAX) { |
209 | SETCX(IEEE754_OVERFLOW); | 209 | ieee754_setcx(IEEE754_OVERFLOW); |
210 | SETCX(IEEE754_INEXACT); | 210 | ieee754_setcx(IEEE754_INEXACT); |
211 | /* -O can be table indexed by (rm,sn) */ | 211 | /* -O can be table indexed by (rm,sn) */ |
212 | switch (ieee754_csr.rm) { | 212 | switch (ieee754_csr.rm) { |
213 | case IEEE754_RN: | 213 | case IEEE754_RN: |
@@ -232,7 +232,7 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm) | |||
232 | /* we underflow (tiny/zero) */ | 232 | /* we underflow (tiny/zero) */ |
233 | assert(xe == SP_EMIN); | 233 | assert(xe == SP_EMIN); |
234 | if (ieee754_csr.mx & IEEE754_UNDERFLOW) | 234 | if (ieee754_csr.mx & IEEE754_UNDERFLOW) |
235 | SETCX(IEEE754_UNDERFLOW); | 235 | ieee754_setcx(IEEE754_UNDERFLOW); |
236 | return buildsp(sn, SP_EMIN - 1 + SP_EBIAS, xm); | 236 | return buildsp(sn, SP_EMIN - 1 + SP_EBIAS, xm); |
237 | } else { | 237 | } else { |
238 | assert((xm >> (SP_MBITS + 1)) == 0); /* no execess */ | 238 | assert((xm >> (SP_MBITS + 1)) == 0); /* no execess */ |
diff --git a/arch/mips/math-emu/ieee754sp.h b/arch/mips/math-emu/ieee754sp.h index f007c47086cb..011d034fd86e 100644 --- a/arch/mips/math-emu/ieee754sp.h +++ b/arch/mips/math-emu/ieee754sp.h | |||
@@ -81,7 +81,7 @@ extern union ieee754sp ieee754sp_format(int, int, unsigned); | |||
81 | { \ | 81 | { \ |
82 | union ieee754sp V = ieee754sp_format(s, e, m); \ | 82 | union ieee754sp V = ieee754sp_format(s, e, m); \ |
83 | \ | 83 | \ |
84 | if (TSTX()) \ | 84 | if (ieee754_tstx()) \ |
85 | return ieee754sp_xcpt(V, name, a0, a1); \ | 85 | return ieee754sp_xcpt(V, name, a0, a1); \ |
86 | else \ | 86 | else \ |
87 | return V; \ | 87 | return V; \ |
diff --git a/arch/mips/math-emu/sp_add.c b/arch/mips/math-emu/sp_add.c index 4938d8f1d4bc..e67f11af4acf 100644 --- a/arch/mips/math-emu/sp_add.c +++ b/arch/mips/math-emu/sp_add.c | |||
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y) | |||
34 | EXPLODEXSP; | 34 | EXPLODEXSP; |
35 | EXPLODEYSP; | 35 | EXPLODEYSP; |
36 | 36 | ||
37 | CLEARCX; | 37 | ieee754_clearcx(); |
38 | 38 | ||
39 | FLUSHXSP; | 39 | FLUSHXSP; |
40 | FLUSHYSP; | 40 | FLUSHYSP; |
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y) | |||
51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "add", x, y); | 55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "add", x, y); |
56 | 56 | ||
57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -74,7 +74,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y) | |||
74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): | 74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): |
75 | if (xs == ys) | 75 | if (xs == ys) |
76 | return x; | 76 | return x; |
77 | SETCX(IEEE754_INVALID_OPERATION); | 77 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
78 | return ieee754sp_xcpt(ieee754sp_indef(), "add", x, y); | 78 | return ieee754sp_xcpt(ieee754sp_indef(), "add", x, y); |
79 | 79 | ||
80 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): | 80 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): |
diff --git a/arch/mips/math-emu/sp_cmp.c b/arch/mips/math-emu/sp_cmp.c index b98d68617cfe..adf30766ecab 100644 --- a/arch/mips/math-emu/sp_cmp.c +++ b/arch/mips/math-emu/sp_cmp.c | |||
@@ -35,15 +35,15 @@ int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cmp, int sig) | |||
35 | EXPLODEYSP; | 35 | EXPLODEYSP; |
36 | FLUSHXSP; | 36 | FLUSHXSP; |
37 | FLUSHYSP; | 37 | FLUSHYSP; |
38 | CLEARCX; /* Even clear inexact flag here */ | 38 | ieee754_clearcx(); /* Even clear inexact flag here */ |
39 | 39 | ||
40 | if (ieee754sp_isnan(x) || ieee754sp_isnan(y)) { | 40 | if (ieee754sp_isnan(x) || ieee754sp_isnan(y)) { |
41 | if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN) | 41 | if (sig || xc == IEEE754_CLASS_SNAN || yc == IEEE754_CLASS_SNAN) |
42 | SETCX(IEEE754_INVALID_OPERATION); | 42 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
43 | if (cmp & IEEE754_CUN) | 43 | if (cmp & IEEE754_CUN) |
44 | return 1; | 44 | return 1; |
45 | if (cmp & (IEEE754_CLT | IEEE754_CGT)) { | 45 | if (cmp & (IEEE754_CLT | IEEE754_CGT)) { |
46 | if (sig && SETANDTESTCX(IEEE754_INVALID_OPERATION)) | 46 | if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) |
47 | return ieee754si_xcpt(0, "fcmpf", x); | 47 | return ieee754si_xcpt(0, "fcmpf", x); |
48 | } | 48 | } |
49 | return 0; | 49 | return 0; |
diff --git a/arch/mips/math-emu/sp_div.c b/arch/mips/math-emu/sp_div.c index 1f62865ffcbd..4caac973e2a6 100644 --- a/arch/mips/math-emu/sp_div.c +++ b/arch/mips/math-emu/sp_div.c | |||
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) | |||
34 | EXPLODEXSP; | 34 | EXPLODEXSP; |
35 | EXPLODEYSP; | 35 | EXPLODEYSP; |
36 | 36 | ||
37 | CLEARCX; | 37 | ieee754_clearcx(); |
38 | 38 | ||
39 | FLUSHXSP; | 39 | FLUSHXSP; |
40 | FLUSHYSP; | 40 | FLUSHYSP; |
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) | |||
51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "div", x, y); | 55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "div", x, y); |
56 | 56 | ||
57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -72,7 +72,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) | |||
72 | */ | 72 | */ |
73 | 73 | ||
74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): | 74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): |
75 | SETCX(IEEE754_INVALID_OPERATION); | 75 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
76 | return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y); | 76 | return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y); |
77 | 77 | ||
78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): | 78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): |
@@ -89,12 +89,12 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) | |||
89 | */ | 89 | */ |
90 | 90 | ||
91 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): | 91 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): |
92 | SETCX(IEEE754_INVALID_OPERATION); | 92 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
93 | return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y); | 93 | return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y); |
94 | 94 | ||
95 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): | 95 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): |
96 | case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): | 96 | case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): |
97 | SETCX(IEEE754_ZERO_DIVIDE); | 97 | ieee754_setcx(IEEE754_ZERO_DIVIDE); |
98 | return ieee754sp_xcpt(ieee754sp_inf(xs ^ ys), "div", x, y); | 98 | return ieee754sp_xcpt(ieee754sp_inf(xs ^ ys), "div", x, y); |
99 | 99 | ||
100 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): | 100 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): |
diff --git a/arch/mips/math-emu/sp_fdp.c b/arch/mips/math-emu/sp_fdp.c index cbefb88a14ef..569878d7cb98 100644 --- a/arch/mips/math-emu/sp_fdp.c +++ b/arch/mips/math-emu/sp_fdp.c | |||
@@ -33,13 +33,13 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x) | |||
33 | 33 | ||
34 | EXPLODEXDP; | 34 | EXPLODEXDP; |
35 | 35 | ||
36 | CLEARCX; | 36 | ieee754_clearcx(); |
37 | 37 | ||
38 | FLUSHXDP; | 38 | FLUSHXDP; |
39 | 39 | ||
40 | switch (xc) { | 40 | switch (xc) { |
41 | case IEEE754_CLASS_SNAN: | 41 | case IEEE754_CLASS_SNAN: |
42 | SETCX(IEEE754_INVALID_OPERATION); | 42 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
43 | return ieee754sp_nanxcpt(ieee754sp_indef(), "fdp"); | 43 | return ieee754sp_nanxcpt(ieee754sp_indef(), "fdp"); |
44 | case IEEE754_CLASS_QNAN: | 44 | case IEEE754_CLASS_QNAN: |
45 | nan = buildsp(xs, SP_EMAX + 1 + SP_EBIAS, (u32) | 45 | nan = buildsp(xs, SP_EMAX + 1 + SP_EBIAS, (u32) |
@@ -53,8 +53,8 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x) | |||
53 | return ieee754sp_zero(xs); | 53 | return ieee754sp_zero(xs); |
54 | case IEEE754_CLASS_DNORM: | 54 | case IEEE754_CLASS_DNORM: |
55 | /* can't possibly be sp representable */ | 55 | /* can't possibly be sp representable */ |
56 | SETCX(IEEE754_UNDERFLOW); | 56 | ieee754_setcx(IEEE754_UNDERFLOW); |
57 | SETCX(IEEE754_INEXACT); | 57 | ieee754_setcx(IEEE754_INEXACT); |
58 | if ((ieee754_csr.rm == IEEE754_RU && !xs) || | 58 | if ((ieee754_csr.rm == IEEE754_RU && !xs) || |
59 | (ieee754_csr.rm == IEEE754_RD && xs)) | 59 | (ieee754_csr.rm == IEEE754_RD && xs)) |
60 | return ieee754sp_xcpt(ieee754sp_mind(xs), "fdp", x); | 60 | return ieee754sp_xcpt(ieee754sp_mind(xs), "fdp", x); |
diff --git a/arch/mips/math-emu/sp_fint.c b/arch/mips/math-emu/sp_fint.c index 7ba2b40348c4..74619e73796c 100644 --- a/arch/mips/math-emu/sp_fint.c +++ b/arch/mips/math-emu/sp_fint.c | |||
@@ -32,7 +32,7 @@ union ieee754sp ieee754sp_fint(int x) | |||
32 | int xe; | 32 | int xe; |
33 | int xs; | 33 | int xs; |
34 | 34 | ||
35 | CLEARCX; | 35 | ieee754_clearcx(); |
36 | 36 | ||
37 | if (x == 0) | 37 | if (x == 0) |
38 | return ieee754sp_zero(0); | 38 | return ieee754sp_zero(0); |
diff --git a/arch/mips/math-emu/sp_flong.c b/arch/mips/math-emu/sp_flong.c index c457a9f8a148..ea065ae14766 100644 --- a/arch/mips/math-emu/sp_flong.c +++ b/arch/mips/math-emu/sp_flong.c | |||
@@ -32,7 +32,7 @@ union ieee754sp ieee754sp_flong(s64 x) | |||
32 | int xe; | 32 | int xe; |
33 | int xs; | 33 | int xs; |
34 | 34 | ||
35 | CLEARCX; | 35 | ieee754_clearcx(); |
36 | 36 | ||
37 | if (x == 0) | 37 | if (x == 0) |
38 | return ieee754sp_zero(0); | 38 | return ieee754sp_zero(0); |
diff --git a/arch/mips/math-emu/sp_frexp.c b/arch/mips/math-emu/sp_frexp.c index 668252bca513..72cedb088506 100644 --- a/arch/mips/math-emu/sp_frexp.c +++ b/arch/mips/math-emu/sp_frexp.c | |||
@@ -31,7 +31,7 @@ | |||
31 | union ieee754sp ieee754sp_frexp(union ieee754sp x, int *eptr) | 31 | union ieee754sp ieee754sp_frexp(union ieee754sp x, int *eptr) |
32 | { | 32 | { |
33 | COMPXSP; | 33 | COMPXSP; |
34 | CLEARCX; | 34 | ieee754_clearcx(); |
35 | EXPLODEXSP; | 35 | EXPLODEXSP; |
36 | 36 | ||
37 | switch (xc) { | 37 | switch (xc) { |
diff --git a/arch/mips/math-emu/sp_logb.c b/arch/mips/math-emu/sp_logb.c index 4dfe5386e89d..82c122c9a447 100644 --- a/arch/mips/math-emu/sp_logb.c +++ b/arch/mips/math-emu/sp_logb.c | |||
@@ -30,7 +30,7 @@ union ieee754sp ieee754sp_logb(union ieee754sp x) | |||
30 | { | 30 | { |
31 | COMPXSP; | 31 | COMPXSP; |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXSP; | 35 | EXPLODEXSP; |
36 | 36 | ||
diff --git a/arch/mips/math-emu/sp_modf.c b/arch/mips/math-emu/sp_modf.c index 30d53ec1f7eb..22f19a22ab02 100644 --- a/arch/mips/math-emu/sp_modf.c +++ b/arch/mips/math-emu/sp_modf.c | |||
@@ -32,7 +32,7 @@ union ieee754sp ieee754sp_modf(union ieee754sp x, union ieee754sp *ip) | |||
32 | { | 32 | { |
33 | COMPXSP; | 33 | COMPXSP; |
34 | 34 | ||
35 | CLEARCX; | 35 | ieee754_clearcx(); |
36 | 36 | ||
37 | EXPLODEXSP; | 37 | EXPLODEXSP; |
38 | 38 | ||
diff --git a/arch/mips/math-emu/sp_mul.c b/arch/mips/math-emu/sp_mul.c index c628f3c495dc..844b3bde0ab6 100644 --- a/arch/mips/math-emu/sp_mul.c +++ b/arch/mips/math-emu/sp_mul.c | |||
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y) | |||
34 | EXPLODEXSP; | 34 | EXPLODEXSP; |
35 | EXPLODEYSP; | 35 | EXPLODEYSP; |
36 | 36 | ||
37 | CLEARCX; | 37 | ieee754_clearcx(); |
38 | 38 | ||
39 | FLUSHXSP; | 39 | FLUSHXSP; |
40 | FLUSHYSP; | 40 | FLUSHYSP; |
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y) | |||
51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "mul", x, y); | 55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "mul", x, y); |
56 | 56 | ||
57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -72,7 +72,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y) | |||
72 | 72 | ||
73 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): | 73 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): |
74 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): | 74 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): |
75 | SETCX(IEEE754_INVALID_OPERATION); | 75 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
76 | return ieee754sp_xcpt(ieee754sp_indef(), "mul", x, y); | 76 | return ieee754sp_xcpt(ieee754sp_indef(), "mul", x, y); |
77 | 77 | ||
78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): | 78 | case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): |
diff --git a/arch/mips/math-emu/sp_scalb.c b/arch/mips/math-emu/sp_scalb.c index 9831d428af6f..cc8f1b82d2a9 100644 --- a/arch/mips/math-emu/sp_scalb.c +++ b/arch/mips/math-emu/sp_scalb.c | |||
@@ -30,7 +30,7 @@ union ieee754sp ieee754sp_scalb(union ieee754sp x, int n) | |||
30 | { | 30 | { |
31 | COMPXSP; | 31 | COMPXSP; |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXSP; | 35 | EXPLODEXSP; |
36 | 36 | ||
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c index 633c7a54cf1e..4da597b6a1f7 100644 --- a/arch/mips/math-emu/sp_simple.c +++ b/arch/mips/math-emu/sp_simple.c | |||
@@ -33,7 +33,7 @@ int ieee754sp_finite(union ieee754sp x) | |||
33 | 33 | ||
34 | union ieee754sp ieee754sp_copysign(union ieee754sp x, union ieee754sp y) | 34 | union ieee754sp ieee754sp_copysign(union ieee754sp x, union ieee754sp y) |
35 | { | 35 | { |
36 | CLEARCX; | 36 | ieee754_clearcx(); |
37 | SPSIGN(x) = SPSIGN(y); | 37 | SPSIGN(x) = SPSIGN(y); |
38 | return x; | 38 | return x; |
39 | } | 39 | } |
@@ -44,7 +44,7 @@ union ieee754sp ieee754sp_neg(union ieee754sp x) | |||
44 | COMPXSP; | 44 | COMPXSP; |
45 | 45 | ||
46 | EXPLODEXSP; | 46 | EXPLODEXSP; |
47 | CLEARCX; | 47 | ieee754_clearcx(); |
48 | FLUSHXSP; | 48 | FLUSHXSP; |
49 | 49 | ||
50 | /* | 50 | /* |
@@ -56,7 +56,7 @@ union ieee754sp ieee754sp_neg(union ieee754sp x) | |||
56 | 56 | ||
57 | if (xc == IEEE754_CLASS_SNAN) { | 57 | if (xc == IEEE754_CLASS_SNAN) { |
58 | union ieee754sp y = ieee754sp_indef(); | 58 | union ieee754sp y = ieee754sp_indef(); |
59 | SETCX(IEEE754_INVALID_OPERATION); | 59 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
60 | SPSIGN(y) = SPSIGN(x); | 60 | SPSIGN(y) = SPSIGN(x); |
61 | return ieee754sp_nanxcpt(y, "neg"); | 61 | return ieee754sp_nanxcpt(y, "neg"); |
62 | } | 62 | } |
@@ -70,14 +70,14 @@ union ieee754sp ieee754sp_abs(union ieee754sp x) | |||
70 | COMPXSP; | 70 | COMPXSP; |
71 | 71 | ||
72 | EXPLODEXSP; | 72 | EXPLODEXSP; |
73 | CLEARCX; | 73 | ieee754_clearcx(); |
74 | FLUSHXSP; | 74 | FLUSHXSP; |
75 | 75 | ||
76 | /* Clear sign ALWAYS, irrespective of NaN */ | 76 | /* Clear sign ALWAYS, irrespective of NaN */ |
77 | SPSIGN(x) = 0; | 77 | SPSIGN(x) = 0; |
78 | 78 | ||
79 | if (xc == IEEE754_CLASS_SNAN) { | 79 | if (xc == IEEE754_CLASS_SNAN) { |
80 | SETCX(IEEE754_INVALID_OPERATION); | 80 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
81 | return ieee754sp_nanxcpt(ieee754sp_indef(), "abs"); | 81 | return ieee754sp_nanxcpt(ieee754sp_indef(), "abs"); |
82 | } | 82 | } |
83 | 83 | ||
diff --git a/arch/mips/math-emu/sp_sqrt.c b/arch/mips/math-emu/sp_sqrt.c index 4c60d91961f4..7e87f469b979 100644 --- a/arch/mips/math-emu/sp_sqrt.c +++ b/arch/mips/math-emu/sp_sqrt.c | |||
@@ -35,7 +35,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) | |||
35 | /* take care of Inf and NaN */ | 35 | /* take care of Inf and NaN */ |
36 | 36 | ||
37 | EXPLODEXSP; | 37 | EXPLODEXSP; |
38 | CLEARCX; | 38 | ieee754_clearcx(); |
39 | FLUSHXSP; | 39 | FLUSHXSP; |
40 | 40 | ||
41 | /* x == INF or NAN? */ | 41 | /* x == INF or NAN? */ |
@@ -44,7 +44,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) | |||
44 | /* sqrt(Nan) = Nan */ | 44 | /* sqrt(Nan) = Nan */ |
45 | return ieee754sp_nanxcpt(x, "sqrt"); | 45 | return ieee754sp_nanxcpt(x, "sqrt"); |
46 | case IEEE754_CLASS_SNAN: | 46 | case IEEE754_CLASS_SNAN: |
47 | SETCX(IEEE754_INVALID_OPERATION); | 47 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
48 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); | 48 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); |
49 | case IEEE754_CLASS_ZERO: | 49 | case IEEE754_CLASS_ZERO: |
50 | /* sqrt(0) = 0 */ | 50 | /* sqrt(0) = 0 */ |
@@ -52,7 +52,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) | |||
52 | case IEEE754_CLASS_INF: | 52 | case IEEE754_CLASS_INF: |
53 | if (xs) { | 53 | if (xs) { |
54 | /* sqrt(-Inf) = Nan */ | 54 | /* sqrt(-Inf) = Nan */ |
55 | SETCX(IEEE754_INVALID_OPERATION); | 55 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
56 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); | 56 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); |
57 | } | 57 | } |
58 | /* sqrt(+Inf) = Inf */ | 58 | /* sqrt(+Inf) = Inf */ |
@@ -61,7 +61,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) | |||
61 | case IEEE754_CLASS_NORM: | 61 | case IEEE754_CLASS_NORM: |
62 | if (xs) { | 62 | if (xs) { |
63 | /* sqrt(-x) = Nan */ | 63 | /* sqrt(-x) = Nan */ |
64 | SETCX(IEEE754_INVALID_OPERATION); | 64 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
65 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); | 65 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); |
66 | } | 66 | } |
67 | break; | 67 | break; |
@@ -99,7 +99,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | if (ix != 0) { | 101 | if (ix != 0) { |
102 | SETCX(IEEE754_INEXACT); | 102 | ieee754_setcx(IEEE754_INEXACT); |
103 | switch (ieee754_csr.rm) { | 103 | switch (ieee754_csr.rm) { |
104 | case IEEE754_RP: | 104 | case IEEE754_RP: |
105 | q += 2; | 105 | q += 2; |
diff --git a/arch/mips/math-emu/sp_sub.c b/arch/mips/math-emu/sp_sub.c index ed67acfb114f..7e45ba3c2a38 100644 --- a/arch/mips/math-emu/sp_sub.c +++ b/arch/mips/math-emu/sp_sub.c | |||
@@ -34,7 +34,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y) | |||
34 | EXPLODEXSP; | 34 | EXPLODEXSP; |
35 | EXPLODEYSP; | 35 | EXPLODEYSP; |
36 | 36 | ||
37 | CLEARCX; | 37 | ieee754_clearcx(); |
38 | 38 | ||
39 | FLUSHXSP; | 39 | FLUSHXSP; |
40 | FLUSHYSP; | 40 | FLUSHYSP; |
@@ -51,7 +51,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y) | |||
51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): | 51 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_NORM): |
52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): | 52 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): |
53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): | 53 | case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): |
54 | SETCX(IEEE754_INVALID_OPERATION); | 54 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sub", x, y); | 55 | return ieee754sp_nanxcpt(ieee754sp_indef(), "sub", x, y); |
56 | 56 | ||
57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): | 57 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): |
@@ -74,7 +74,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y) | |||
74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): | 74 | case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): |
75 | if (xs != ys) | 75 | if (xs != ys) |
76 | return x; | 76 | return x; |
77 | SETCX(IEEE754_INVALID_OPERATION); | 77 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
78 | return ieee754sp_xcpt(ieee754sp_indef(), "sub", x, y); | 78 | return ieee754sp_xcpt(ieee754sp_indef(), "sub", x, y); |
79 | 79 | ||
80 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): | 80 | case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): |
diff --git a/arch/mips/math-emu/sp_tint.c b/arch/mips/math-emu/sp_tint.c index a69dfe5dda3a..febcf5cc4fbc 100644 --- a/arch/mips/math-emu/sp_tint.c +++ b/arch/mips/math-emu/sp_tint.c | |||
@@ -30,7 +30,7 @@ int ieee754sp_tint(union ieee754sp x) | |||
30 | { | 30 | { |
31 | COMPXSP; | 31 | COMPXSP; |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXSP; | 35 | EXPLODEXSP; |
36 | FLUSHXSP; | 36 | FLUSHXSP; |
@@ -39,7 +39,7 @@ int ieee754sp_tint(union ieee754sp x) | |||
39 | case IEEE754_CLASS_SNAN: | 39 | case IEEE754_CLASS_SNAN: |
40 | case IEEE754_CLASS_QNAN: | 40 | case IEEE754_CLASS_QNAN: |
41 | case IEEE754_CLASS_INF: | 41 | case IEEE754_CLASS_INF: |
42 | SETCX(IEEE754_INVALID_OPERATION); | 42 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
43 | return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); | 43 | return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); |
44 | case IEEE754_CLASS_ZERO: | 44 | case IEEE754_CLASS_ZERO: |
45 | return 0; | 45 | return 0; |
@@ -53,7 +53,7 @@ int ieee754sp_tint(union ieee754sp x) | |||
53 | return -0x80000000; | 53 | return -0x80000000; |
54 | /* Set invalid. We will only use overflow for floating | 54 | /* Set invalid. We will only use overflow for floating |
55 | point overflow */ | 55 | point overflow */ |
56 | SETCX(IEEE754_INVALID_OPERATION); | 56 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
57 | return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); | 57 | return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); |
58 | } | 58 | } |
59 | /* oh gawd */ | 59 | /* oh gawd */ |
@@ -99,11 +99,11 @@ int ieee754sp_tint(union ieee754sp x) | |||
99 | } | 99 | } |
100 | if ((xm >> 31) != 0) { | 100 | if ((xm >> 31) != 0) { |
101 | /* This can happen after rounding */ | 101 | /* This can happen after rounding */ |
102 | SETCX(IEEE754_INVALID_OPERATION); | 102 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
103 | return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); | 103 | return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); |
104 | } | 104 | } |
105 | if (round || sticky) | 105 | if (round || sticky) |
106 | SETCX(IEEE754_INEXACT); | 106 | ieee754_setcx(IEEE754_INEXACT); |
107 | } | 107 | } |
108 | if (xs) | 108 | if (xs) |
109 | return -xm; | 109 | return -xm; |
diff --git a/arch/mips/math-emu/sp_tlong.c b/arch/mips/math-emu/sp_tlong.c index da412d38d5ef..a05d09318fb1 100644 --- a/arch/mips/math-emu/sp_tlong.c +++ b/arch/mips/math-emu/sp_tlong.c | |||
@@ -30,7 +30,7 @@ s64 ieee754sp_tlong(union ieee754sp x) | |||
30 | { | 30 | { |
31 | COMPXDP; /* <-- need 64-bit mantissa tmp */ | 31 | COMPXDP; /* <-- need 64-bit mantissa tmp */ |
32 | 32 | ||
33 | CLEARCX; | 33 | ieee754_clearcx(); |
34 | 34 | ||
35 | EXPLODEXSP; | 35 | EXPLODEXSP; |
36 | FLUSHXSP; | 36 | FLUSHXSP; |
@@ -39,7 +39,7 @@ s64 ieee754sp_tlong(union ieee754sp x) | |||
39 | case IEEE754_CLASS_SNAN: | 39 | case IEEE754_CLASS_SNAN: |
40 | case IEEE754_CLASS_QNAN: | 40 | case IEEE754_CLASS_QNAN: |
41 | case IEEE754_CLASS_INF: | 41 | case IEEE754_CLASS_INF: |
42 | SETCX(IEEE754_INVALID_OPERATION); | 42 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
43 | return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); | 43 | return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); |
44 | case IEEE754_CLASS_ZERO: | 44 | case IEEE754_CLASS_ZERO: |
45 | return 0; | 45 | return 0; |
@@ -53,7 +53,7 @@ s64 ieee754sp_tlong(union ieee754sp x) | |||
53 | return -0x8000000000000000LL; | 53 | return -0x8000000000000000LL; |
54 | /* Set invalid. We will only use overflow for floating | 54 | /* Set invalid. We will only use overflow for floating |
55 | point overflow */ | 55 | point overflow */ |
56 | SETCX(IEEE754_INVALID_OPERATION); | 56 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
57 | return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); | 57 | return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); |
58 | } | 58 | } |
59 | /* oh gawd */ | 59 | /* oh gawd */ |
@@ -95,11 +95,11 @@ s64 ieee754sp_tlong(union ieee754sp x) | |||
95 | } | 95 | } |
96 | if ((xm >> 63) != 0) { | 96 | if ((xm >> 63) != 0) { |
97 | /* This can happen after rounding */ | 97 | /* This can happen after rounding */ |
98 | SETCX(IEEE754_INVALID_OPERATION); | 98 | ieee754_setcx(IEEE754_INVALID_OPERATION); |
99 | return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); | 99 | return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); |
100 | } | 100 | } |
101 | if (round || sticky) | 101 | if (round || sticky) |
102 | SETCX(IEEE754_INEXACT); | 102 | ieee754_setcx(IEEE754_INEXACT); |
103 | } | 103 | } |
104 | if (xs) | 104 | if (xs) |
105 | return -xm; | 105 | return -xm; |