diff options
Diffstat (limited to 'arch')
32 files changed, 92 insertions, 263 deletions
diff --git a/arch/mips/math-emu/Makefile b/arch/mips/math-emu/Makefile index 016736ed304c..383cc7889774 100644 --- a/arch/mips/math-emu/Makefile +++ b/arch/mips/math-emu/Makefile @@ -2,8 +2,8 @@ # Makefile for the Linux/MIPS kernel FPU emulation. # -obj-y += cp1emu.o ieee754dp.o ieee754sp.o ieee754.o ieee754xcpt.o dp_div.o \ - dp_mul.o dp_sub.o dp_add.o dp_fsp.o dp_cmp.o dp_simple.o dp_tint.o \ +obj-y += cp1emu.o ieee754dp.o ieee754sp.o ieee754.o dp_div.o dp_mul.o \ + dp_sub.o dp_add.o dp_fsp.o dp_cmp.o dp_simple.o dp_tint.o \ dp_fint.o dp_tlong.o dp_flong.o sp_div.o sp_mul.o sp_sub.o \ sp_add.o sp_fdp.o sp_cmp.o sp_simple.o sp_tint.o sp_fint.o \ sp_tlong.o sp_flong.o kernel_linkage.o dsemul.o diff --git a/arch/mips/math-emu/dp_add.c b/arch/mips/math-emu/dp_add.c index f1c8e70e8beb..48b9ef6f8a0d 100644 --- a/arch/mips/math-emu/dp_add.c +++ b/arch/mips/math-emu/dp_add.c @@ -53,7 +53,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "add", x, y); + return ieee754dp_nanxcpt(ieee754dp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -76,7 +76,7 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y) if (xs == ys) return x; ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_xcpt(ieee754dp_indef(), "add", x, y); + return ieee754dp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): @@ -178,5 +178,6 @@ union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y) } } - DPNORMRET2(xs, xe, xm, "add", x, y); + + return ieee754dp_format(xs, xe, xm); } diff --git a/arch/mips/math-emu/dp_cmp.c b/arch/mips/math-emu/dp_cmp.c index 2d9390ecf60d..fe573cb6f77f 100644 --- a/arch/mips/math-emu/dp_cmp.c +++ b/arch/mips/math-emu/dp_cmp.c @@ -44,7 +44,7 @@ int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cmp, int sig) return 1; if (cmp & (IEEE754_CLT | IEEE754_CGT)) { if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) - return ieee754di_xcpt(0, "fcmpf", x); + return 0; } return 0; } else { diff --git a/arch/mips/math-emu/dp_div.c b/arch/mips/math-emu/dp_div.c index 13ecffa9c25e..377e11470e3f 100644 --- a/arch/mips/math-emu/dp_div.c +++ b/arch/mips/math-emu/dp_div.c @@ -52,7 +52,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "div", x, y); + return ieee754dp_nanxcpt(ieee754dp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -73,7 +73,7 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y); + return ieee754dp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): @@ -90,12 +90,12 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_xcpt(ieee754dp_indef(), "div", x, y); + return ieee754dp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): ieee754_setcx(IEEE754_ZERO_DIVIDE); - return ieee754dp_xcpt(ieee754dp_inf(xs ^ ys), "div", x, y); + return ieee754dp_inf(xs ^ ys); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM): @@ -151,6 +151,6 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y) re--; } - DPNORMRET2(xs == ys ? 0 : 1, re, rm, "div", x, y); + return ieee754dp_format(xs == ys ? 0 : 1, re, rm); } } diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c index fb5eeaadf253..54c8f005acb2 100644 --- a/arch/mips/math-emu/dp_flong.c +++ b/arch/mips/math-emu/dp_flong.c @@ -65,5 +65,6 @@ union ieee754dp ieee754dp_flong(s64 x) xe--; } } - DPNORMRET1(xs, xe, xm, "dp_flong", x); + + return ieee754dp_format(xs, xe, xm); } diff --git a/arch/mips/math-emu/dp_fsp.c b/arch/mips/math-emu/dp_fsp.c index 67ee97f06268..ba600be69454 100644 --- a/arch/mips/math-emu/dp_fsp.c +++ b/arch/mips/math-emu/dp_fsp.c @@ -40,14 +40,13 @@ union ieee754dp ieee754dp_fsp(union ieee754sp x) switch (xc) { case IEEE754_CLASS_SNAN: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "fsp"); + return ieee754dp_nanxcpt(ieee754dp_indef()); case IEEE754_CLASS_QNAN: return ieee754dp_nanxcpt(builddp(xs, DP_EMAX + 1 + DP_EBIAS, ((u64) xm << (DP_FBITS - - SP_FBITS))), "fsp", - x); + SP_FBITS)))); case IEEE754_CLASS_INF: return ieee754dp_inf(xs); case IEEE754_CLASS_ZERO: diff --git a/arch/mips/math-emu/dp_mul.c b/arch/mips/math-emu/dp_mul.c index 56fb309b42c1..74bc81017497 100644 --- a/arch/mips/math-emu/dp_mul.c +++ b/arch/mips/math-emu/dp_mul.c @@ -52,7 +52,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "mul", x, y); + return ieee754dp_nanxcpt(ieee754dp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -73,7 +73,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y) case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_xcpt(ieee754dp_indef(), "mul", x, y); + return ieee754dp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): @@ -171,6 +171,7 @@ union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y) ((rm << (DP_FBITS + 1 + 3 + 1)) != 0); } assert(rm & (DP_HIDDEN_BIT << 3)); - DPNORMRET2(rs, re, rm, "mul", x, y); + + return ieee754dp_format(rs, re, rm); } } diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c index fddeb33107dd..4eda7595b151 100644 --- a/arch/mips/math-emu/dp_simple.c +++ b/arch/mips/math-emu/dp_simple.c @@ -45,7 +45,7 @@ union ieee754dp ieee754dp_neg(union ieee754dp x) union ieee754dp y = ieee754dp_indef(); ieee754_setcx(IEEE754_INVALID_OPERATION); DPSIGN(y) = DPSIGN(x); - return ieee754dp_nanxcpt(y, "neg"); + return ieee754dp_nanxcpt(y); } return x; @@ -65,7 +65,7 @@ union ieee754dp ieee754dp_abs(union ieee754dp x) if (xc == IEEE754_CLASS_SNAN) { ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "abs"); + return ieee754dp_nanxcpt(ieee754dp_indef()); } return x; diff --git a/arch/mips/math-emu/dp_sqrt.c b/arch/mips/math-emu/dp_sqrt.c index 1e0fbbf56e97..3c36a86d1473 100644 --- a/arch/mips/math-emu/dp_sqrt.c +++ b/arch/mips/math-emu/dp_sqrt.c @@ -49,10 +49,10 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x) switch (xc) { case IEEE754_CLASS_QNAN: /* sqrt(Nan) = Nan */ - return ieee754dp_nanxcpt(x, "sqrt"); + return ieee754dp_nanxcpt(x); case IEEE754_CLASS_SNAN: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); + return ieee754dp_nanxcpt(ieee754dp_indef()); case IEEE754_CLASS_ZERO: /* sqrt(0) = 0 */ return x; @@ -60,7 +60,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x) if (xs) { /* sqrt(-Inf) = Nan */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); + return ieee754dp_nanxcpt(ieee754dp_indef()); } /* sqrt(+Inf) = Inf */ return x; @@ -71,7 +71,7 @@ union ieee754dp ieee754dp_sqrt(union ieee754dp x) if (xs) { /* sqrt(-x) = Nan */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "sqrt"); + return ieee754dp_nanxcpt(ieee754dp_indef()); } break; } diff --git a/arch/mips/math-emu/dp_sub.c b/arch/mips/math-emu/dp_sub.c index 25d25bc8d977..3dd62c186767 100644 --- a/arch/mips/math-emu/dp_sub.c +++ b/arch/mips/math-emu/dp_sub.c @@ -52,7 +52,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_nanxcpt(ieee754dp_indef(), "sub", x, y); + return ieee754dp_nanxcpt(ieee754dp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -75,7 +75,7 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) if (xs != ys) return x; ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754dp_xcpt(ieee754dp_indef(), "sub", x, y); + return ieee754dp_indef(); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): @@ -186,5 +186,6 @@ union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y) xe--; } } - DPNORMRET2(xs, xe, xm, "sub", x, y); + + return ieee754dp_format(xs, xe, xm); } diff --git a/arch/mips/math-emu/dp_tint.c b/arch/mips/math-emu/dp_tint.c index 1270009aee9b..3a23c6409275 100644 --- a/arch/mips/math-emu/dp_tint.c +++ b/arch/mips/math-emu/dp_tint.c @@ -40,7 +40,7 @@ int ieee754dp_tint(union ieee754dp x) case IEEE754_CLASS_QNAN: case IEEE754_CLASS_INF: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); + return ieee754si_indef(); case IEEE754_CLASS_ZERO: return 0; case IEEE754_CLASS_DNORM: @@ -51,7 +51,7 @@ int ieee754dp_tint(union ieee754dp x) /* Set invalid. We will only use overflow for floating point overflow */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); + return ieee754si_indef(); } /* oh gawd */ if (xe > DP_FBITS) { @@ -96,7 +96,7 @@ int ieee754dp_tint(union ieee754dp x) if ((xm >> 31) != 0 && (xs == 0 || xm != 0x80000000)) { /* This can happen after rounding */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754si_xcpt(ieee754si_indef(), "dp_tint", x); + return ieee754si_indef(); } if (round || sticky) ieee754_setcx(IEEE754_INEXACT); diff --git a/arch/mips/math-emu/dp_tlong.c b/arch/mips/math-emu/dp_tlong.c index b9a43a2d4b36..cbeef6098e76 100644 --- a/arch/mips/math-emu/dp_tlong.c +++ b/arch/mips/math-emu/dp_tlong.c @@ -40,7 +40,7 @@ s64 ieee754dp_tlong(union ieee754dp x) case IEEE754_CLASS_QNAN: case IEEE754_CLASS_INF: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); + return ieee754di_indef(); case IEEE754_CLASS_ZERO: return 0; case IEEE754_CLASS_DNORM: @@ -54,7 +54,7 @@ s64 ieee754dp_tlong(union ieee754dp x) /* Set invalid. We will only use overflow for floating point overflow */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); + return ieee754di_indef(); } /* oh gawd */ if (xe > DP_FBITS) { @@ -100,7 +100,7 @@ s64 ieee754dp_tlong(union ieee754dp x) if ((xm >> 63) != 0) { /* This can happen after rounding */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754di_xcpt(ieee754di_indef(), "dp_tlong", x); + return ieee754di_indef(); } if (round || sticky) ieee754_setcx(IEEE754_INEXACT); diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c index f3b5fa0adbbb..ab53f849f2c7 100644 --- a/arch/mips/math-emu/ieee754.c +++ b/arch/mips/math-emu/ieee754.c @@ -28,7 +28,6 @@ * ######################################################################## */ -#include <stdarg.h> #include <linux/compiler.h> #include "ieee754int.h" @@ -38,15 +37,13 @@ /* special constants */ -#ifdef __MIPSEB__ -#define SPSTR(s, b, m) {s, b, m} -#define DPSTR(s, b, mh, ml) {s, b, mh, ml} -#elif defined(__MIPSEL__) -#define SPSTR(s, b, m) {m, b, s} -#define DPSTR(s, b, mh, ml) {ml, mh, b, s} -#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */ -#error "MIPS but neither __MIPSEB__ nor __MIPSEL__?" -#endif +#define DPSTR(s, b, mh, ml) \ +{ \ + .sign = (s), \ + .bexp = (b), \ + .manthi = (mh), \ + .mantlo = (ml) \ +} const struct ieee754dp_const __ieee754dp_spcvals[] = { DPSTR(0, DP_EMIN - 1 + DP_EBIAS, 0, 0), /* + zero */ @@ -68,6 +65,13 @@ const struct ieee754dp_const __ieee754dp_spcvals[] = { DPSTR(0, 63 + DP_EBIAS, 0, 0), /* + 1.0e63 */ }; +#define SPSTR(s, b, m) \ +{ \ + .sign = (s), \ + .bexp = (b), \ + .mant = (m) \ +} + const struct ieee754sp_const __ieee754sp_spcvals[] = { SPSTR(0, SP_EMIN - 1 + SP_EBIAS, 0), /* + zero */ SPSTR(1, SP_EMIN - 1 + SP_EBIAS, 0), /* - zero */ @@ -87,34 +91,3 @@ const struct ieee754sp_const __ieee754sp_spcvals[] = { SPSTR(0, 31 + SP_EBIAS, 0), /* + 1.0e31 */ SPSTR(0, 63 + SP_EBIAS, 0), /* + 1.0e63 */ }; - - -int __cold ieee754si_xcpt(int r, const char *op, ...) -{ - struct ieee754xctx ax; - - if (!ieee754_tstx()) - return r; - ax.op = op; - ax.rt = IEEE754_RT_SI; - ax.rv.si = r; - va_start(ax.ap, op); - ieee754_xcpt(&ax); - va_end(ax.ap); - return ax.rv.si; -} - -s64 __cold ieee754di_xcpt(s64 r, const char *op, ...) -{ - struct ieee754xctx ax; - - if (!ieee754_tstx()) - return r; - ax.op = op; - ax.rt = IEEE754_RT_DI; - ax.rv.di = r; - va_start(ax.ap, op); - ieee754_xcpt(&ax); - va_end(ax.ap); - return ax.rv.di; -} diff --git a/arch/mips/math-emu/ieee754.h b/arch/mips/math-emu/ieee754.h index a62aa5a40af9..e87a6361149b 100644 --- a/arch/mips/math-emu/ieee754.h +++ b/arch/mips/math-emu/ieee754.h @@ -24,7 +24,6 @@ #ifndef __ARCH_MIPS_MATH_EMU_IEEE754_H #define __ARCH_MIPS_MATH_EMU_IEEE754_H -#include <stdarg.h> #include <linux/compiler.h> #include <asm/byteorder.h> #include <linux/kernel.h> @@ -343,19 +342,6 @@ static inline s64 ieee754di_indef(void) return S64_MAX; } -/* IEEE exception context, passed to handler */ -struct ieee754xctx { - const char *op; /* operation name */ - int rt; /* result type */ - union { - union ieee754sp sp; /* single precision */ - union ieee754dp dp; /* double precision */ - int si; /* standard signed integer (32bits) */ - s64 di; /* extended signed integer (64bits) */ - } rv; /* default result format implied by op */ - va_list ap; -}; - /* result types for xctx.rt */ #define IEEE754_RT_SP 0 #define IEEE754_RT_DP 1 @@ -363,8 +349,6 @@ struct ieee754xctx { #define IEEE754_RT_SI 3 #define IEEE754_RT_DI 4 -extern void __cold ieee754_xcpt(struct ieee754xctx *xcp); - /* compat */ #define ieee754dp_fix(x) ieee754dp_tint(x) #define ieee754sp_fix(x) ieee754sp_tint(x) diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c index d9ceb6bd3536..39c018856834 100644 --- a/arch/mips/math-emu/ieee754dp.c +++ b/arch/mips/math-emu/ieee754dp.c @@ -23,7 +23,6 @@ * ######################################################################## */ -#include <stdarg.h> #include <linux/compiler.h> #include "ieee754dp.h" @@ -47,25 +46,8 @@ static inline int ieee754dp_issnan(union ieee754dp x) } -union ieee754dp __cold ieee754dp_xcpt(union ieee754dp r, const char *op, ...) +union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp r) { - struct ieee754xctx ax; - if (!ieee754_tstx()) - return r; - - ax.op = op; - ax.rt = IEEE754_RT_DP; - ax.rv.dp = r; - va_start(ax.ap, op); - ieee754_xcpt(&ax); - va_end(ax.ap); - return ax.rv.dp; -} - -union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp r, const char *op, ...) -{ - struct ieee754xctx ax; - assert(ieee754dp_isnan(r)); if (!ieee754dp_issnan(r)) /* QNAN does not cause invalid op !! */ @@ -80,13 +62,7 @@ union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp r, const char *op, ...) return ieee754dp_indef(); } - ax.op = op; - ax.rt = 0; - ax.rv.dp = r; - va_start(ax.ap, op); - ieee754_xcpt(&ax); - va_end(ax.ap); - return ax.rv.dp; + return r; } static u64 get_rounding(int sn, u64 xm) diff --git a/arch/mips/math-emu/ieee754dp.h b/arch/mips/math-emu/ieee754dp.h index 179d249a627b..91d785e49101 100644 --- a/arch/mips/math-emu/ieee754dp.h +++ b/arch/mips/math-emu/ieee754dp.h @@ -81,20 +81,5 @@ static inline union ieee754dp builddp(int s, int bx, u64 m) } extern int ieee754dp_isnan(union ieee754dp); -extern int __cold ieee754si_xcpt(int, const char *, ...); -extern s64 __cold ieee754di_xcpt(s64, const char *, ...); -extern union ieee754dp __cold ieee754dp_xcpt(union ieee754dp, const char *, ...); -extern union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp, const char *, ...); +extern union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp); extern union ieee754dp ieee754dp_format(int, int, u64); - - -#define DPNORMRET2(s, e, m, name, a0, a1) \ -{ \ - union ieee754dp V = ieee754dp_format(s, e, m); \ - if (ieee754_tstx()) \ - return ieee754dp_xcpt(V, name, a0, a1); \ - else \ - return V; \ -} - -#define DPNORMRET1(s, e, m, name, a0) DPNORMRET2(s, e, m, name, a0, a0) diff --git a/arch/mips/math-emu/ieee754int.h b/arch/mips/math-emu/ieee754int.h index 4621a3d39a8f..58b90874a7fe 100644 --- a/arch/mips/math-emu/ieee754int.h +++ b/arch/mips/math-emu/ieee754int.h @@ -48,11 +48,6 @@ static inline int ieee754_setandtestcx(const unsigned int x) return ieee754_csr.mx & x; } -static inline int ieee754_tstx(void) -{ - return ieee754_csr.cx & ieee754_csr.mx; -} - #define COMPXSP \ unsigned xm; int xe; int xs __maybe_unused; int xc diff --git a/arch/mips/math-emu/ieee754sp.c b/arch/mips/math-emu/ieee754sp.c index a90837a8cd85..1941c120a168 100644 --- a/arch/mips/math-emu/ieee754sp.c +++ b/arch/mips/math-emu/ieee754sp.c @@ -23,7 +23,6 @@ * ######################################################################## */ -#include <stdarg.h> #include <linux/compiler.h> #include "ieee754sp.h" @@ -47,26 +46,8 @@ static inline int ieee754sp_issnan(union ieee754sp x) } -union ieee754sp __cold ieee754sp_xcpt(union ieee754sp r, const char *op, ...) +union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp r) { - struct ieee754xctx ax; - - if (!ieee754_tstx()) - return r; - - ax.op = op; - ax.rt = IEEE754_RT_SP; - ax.rv.sp = r; - va_start(ax.ap, op); - ieee754_xcpt(&ax); - va_end(ax.ap); - return ax.rv.sp; -} - -union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp r, const char *op, ...) -{ - struct ieee754xctx ax; - assert(ieee754sp_isnan(r)); if (!ieee754sp_issnan(r)) /* QNAN does not cause invalid op !! */ @@ -81,13 +62,7 @@ union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp r, const char *op, ...) return ieee754sp_indef(); } - ax.op = op; - ax.rt = 0; - ax.rv.sp = r; - va_start(ax.ap, op); - ieee754_xcpt(&ax); - va_end(ax.ap); - return ax.rv.sp; + return r; } static unsigned get_rounding(int sn, unsigned xm) diff --git a/arch/mips/math-emu/ieee754sp.h b/arch/mips/math-emu/ieee754sp.h index 0b44569582b9..e5295d7e8ce9 100644 --- a/arch/mips/math-emu/ieee754sp.h +++ b/arch/mips/math-emu/ieee754sp.h @@ -87,21 +87,5 @@ static inline union ieee754sp buildsp(int s, int bx, unsigned m) } extern int ieee754sp_isnan(union ieee754sp); -extern int __cold ieee754si_xcpt(int, const char *, ...); -extern s64 __cold ieee754di_xcpt(s64, const char *, ...); -extern union ieee754sp __cold ieee754sp_xcpt(union ieee754sp, const char *, ...); -extern union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp, const char *, ...); +extern union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp); extern union ieee754sp ieee754sp_format(int, int, unsigned); - - -#define SPNORMRET2(s, e, m, name, a0, a1) \ -{ \ - union ieee754sp V = ieee754sp_format(s, e, m); \ - \ - if (ieee754_tstx()) \ - return ieee754sp_xcpt(V, name, a0, a1); \ - else \ - return V; \ -} - -#define SPNORMRET1(s, e, m, name, a0) SPNORMRET2(s, e, m, name, a0, a0) diff --git a/arch/mips/math-emu/ieee754xcpt.c b/arch/mips/math-emu/ieee754xcpt.c deleted file mode 100644 index d68408a19570..000000000000 --- a/arch/mips/math-emu/ieee754xcpt.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * MIPS floating point support - * Copyright (C) 1994-2000 Algorithmics Ltd. - * - * ######################################################################## - * - * This program is free software; you can distribute it and/or modify it - * under the terms of the GNU General Public License (Version 2) as - * published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * ######################################################################## - */ - -/************************************************************************** - * Nov 7, 2000 - * Added preprocessor hacks to map to Linux kernel diagnostics. - * - * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com - * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. - *************************************************************************/ - -#include <linux/compiler.h> -#include <linux/printk.h> -#include "ieee754.h" - -/* - * Very naff exception handler (you can plug in your own and - * override this). - */ - -static const char *const rtnames[] = { - "sp", "dp", "xp", "si", "di" -}; - -void __cold ieee754_xcpt(struct ieee754xctx *xcp) -{ - printk(KERN_DEBUG "floating point exception in \"%s\", type=%s\n", - xcp->op, rtnames[xcp->rt]); -} diff --git a/arch/mips/math-emu/sp_add.c b/arch/mips/math-emu/sp_add.c index d107bce38bfd..db4d89beada6 100644 --- a/arch/mips/math-emu/sp_add.c +++ b/arch/mips/math-emu/sp_add.c @@ -52,7 +52,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "add", x, y); + return ieee754sp_nanxcpt(ieee754sp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -75,7 +75,7 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y) if (xs == ys) return x; ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_xcpt(ieee754sp_indef(), "add", x, y); + return ieee754sp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): @@ -172,5 +172,6 @@ union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y) } } - SPNORMRET2(xs, xe, xm, "add", x, y); + + return ieee754sp_format(xs, xe, xm); } diff --git a/arch/mips/math-emu/sp_cmp.c b/arch/mips/math-emu/sp_cmp.c index adf30766ecab..fab49887a1b8 100644 --- a/arch/mips/math-emu/sp_cmp.c +++ b/arch/mips/math-emu/sp_cmp.c @@ -44,7 +44,7 @@ int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cmp, int sig) return 1; if (cmp & (IEEE754_CLT | IEEE754_CGT)) { if (sig && ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) - return ieee754si_xcpt(0, "fcmpf", x); + return 0; } return 0; } else { diff --git a/arch/mips/math-emu/sp_div.c b/arch/mips/math-emu/sp_div.c index 095fb20262a9..0d847a4fbc13 100644 --- a/arch/mips/math-emu/sp_div.c +++ b/arch/mips/math-emu/sp_div.c @@ -52,7 +52,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "div", x, y); + return ieee754sp_nanxcpt(ieee754sp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -73,7 +73,7 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y); + return ieee754sp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): @@ -90,12 +90,12 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_ZERO): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_xcpt(ieee754sp_indef(), "div", x, y); + return ieee754sp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO): ieee754_setcx(IEEE754_ZERO_DIVIDE); - return ieee754sp_xcpt(ieee754sp_inf(xs ^ ys), "div", x, y); + return ieee754sp_inf(xs ^ ys); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_NORM): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_DNORM): @@ -151,6 +151,6 @@ union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y) re--; } - SPNORMRET2(xs == ys ? 0 : 1, re, rm, "div", x, y); + return ieee754sp_format(xs == ys ? 0 : 1, re, rm); } } diff --git a/arch/mips/math-emu/sp_fdp.c b/arch/mips/math-emu/sp_fdp.c index ccbed8aadcc4..5c1d8aa6bfd5 100644 --- a/arch/mips/math-emu/sp_fdp.c +++ b/arch/mips/math-emu/sp_fdp.c @@ -41,13 +41,13 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x) switch (xc) { case IEEE754_CLASS_SNAN: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "fdp"); + return ieee754sp_nanxcpt(ieee754sp_indef()); case IEEE754_CLASS_QNAN: nan = buildsp(xs, SP_EMAX + 1 + SP_EBIAS, (u32) (xm >> (DP_FBITS - SP_FBITS))); if (!ieee754sp_isnan(nan)) nan = ieee754sp_indef(); - return ieee754sp_nanxcpt(nan, "fdp", x); + return ieee754sp_nanxcpt(nan); case IEEE754_CLASS_INF: return ieee754sp_inf(xs); case IEEE754_CLASS_ZERO: @@ -58,8 +58,8 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x) ieee754_setcx(IEEE754_INEXACT); if ((ieee754_csr.rm == IEEE754_RU && !xs) || (ieee754_csr.rm == IEEE754_RD && xs)) - return ieee754sp_xcpt(ieee754sp_mind(xs), "fdp", x); - return ieee754sp_xcpt(ieee754sp_zero(xs), "fdp", x); + return ieee754sp_mind(xs); + return ieee754sp_zero(xs); case IEEE754_CLASS_NORM: break; } @@ -72,6 +72,6 @@ union ieee754sp ieee754sp_fdp(union ieee754dp x) rm = (xm >> (DP_FBITS - (SP_FBITS + 3))) | ((xm << (64 - (DP_FBITS - (SP_FBITS + 3)))) != 0); - SPNORMRET1(xs, xe, rm, "fdp", x); + return ieee754sp_format(xs, xe, rm); } } diff --git a/arch/mips/math-emu/sp_fint.c b/arch/mips/math-emu/sp_fint.c index 0d01200793d1..8e8687bf955d 100644 --- a/arch/mips/math-emu/sp_fint.c +++ b/arch/mips/math-emu/sp_fint.c @@ -66,5 +66,5 @@ union ieee754sp ieee754sp_fint(int x) xe--; } } - SPNORMRET1(xs, xe, xm, "fint", x); + return ieee754sp_format(xs, xe, xm); } diff --git a/arch/mips/math-emu/sp_flong.c b/arch/mips/math-emu/sp_flong.c index b26c155cc3e6..e56e87603feb 100644 --- a/arch/mips/math-emu/sp_flong.c +++ b/arch/mips/math-emu/sp_flong.c @@ -65,5 +65,5 @@ union ieee754sp ieee754sp_flong(s64 x) xe--; } } - SPNORMRET1(xs, xe, xm, "sp_flong", x); + return ieee754sp_format(xs, xe, xm); } diff --git a/arch/mips/math-emu/sp_mul.c b/arch/mips/math-emu/sp_mul.c index 28f608f25499..0e19d0edd3f9 100644 --- a/arch/mips/math-emu/sp_mul.c +++ b/arch/mips/math-emu/sp_mul.c @@ -52,7 +52,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "mul", x, y); + return ieee754sp_nanxcpt(ieee754sp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -73,7 +73,7 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y) case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO): case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_xcpt(ieee754sp_indef(), "mul", x, y); + return ieee754sp_indef(); case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): @@ -165,6 +165,6 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y) } assert(rm & (SP_HIDDEN_BIT << 3)); - SPNORMRET2(rs, re, rm, "mul", x, y); + return ieee754sp_format(rs, re, rm); } } diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c index 0f5fd57e2cac..8f0202d73019 100644 --- a/arch/mips/math-emu/sp_simple.c +++ b/arch/mips/math-emu/sp_simple.c @@ -45,7 +45,7 @@ union ieee754sp ieee754sp_neg(union ieee754sp x) union ieee754sp y = ieee754sp_indef(); ieee754_setcx(IEEE754_INVALID_OPERATION); SPSIGN(y) = SPSIGN(x); - return ieee754sp_nanxcpt(y, "neg"); + return ieee754sp_nanxcpt(y); } return x; @@ -65,7 +65,7 @@ union ieee754sp ieee754sp_abs(union ieee754sp x) if (xc == IEEE754_CLASS_SNAN) { ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "abs"); + return ieee754sp_nanxcpt(ieee754sp_indef()); } return x; diff --git a/arch/mips/math-emu/sp_sqrt.c b/arch/mips/math-emu/sp_sqrt.c index 7e87f469b979..f4da2cc8ebe0 100644 --- a/arch/mips/math-emu/sp_sqrt.c +++ b/arch/mips/math-emu/sp_sqrt.c @@ -42,10 +42,10 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) switch (xc) { case IEEE754_CLASS_QNAN: /* sqrt(Nan) = Nan */ - return ieee754sp_nanxcpt(x, "sqrt"); + return ieee754sp_nanxcpt(x); case IEEE754_CLASS_SNAN: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); + return ieee754sp_nanxcpt(ieee754sp_indef()); case IEEE754_CLASS_ZERO: /* sqrt(0) = 0 */ return x; @@ -53,7 +53,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) if (xs) { /* sqrt(-Inf) = Nan */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); + return ieee754sp_nanxcpt(ieee754sp_indef()); } /* sqrt(+Inf) = Inf */ return x; @@ -62,7 +62,7 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x) if (xs) { /* sqrt(-x) = Nan */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "sqrt"); + return ieee754sp_nanxcpt(ieee754sp_indef()); } break; } diff --git a/arch/mips/math-emu/sp_sub.c b/arch/mips/math-emu/sp_sub.c index 828de931690c..67a1f9e6bbfe 100644 --- a/arch/mips/math-emu/sp_sub.c +++ b/arch/mips/math-emu/sp_sub.c @@ -52,7 +52,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y) case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_DNORM): case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF): ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_nanxcpt(ieee754sp_indef(), "sub", x, y); + return ieee754sp_nanxcpt(ieee754sp_indef()); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN): case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN): @@ -75,7 +75,7 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y) if (xs != ys) return x; ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754sp_xcpt(ieee754sp_indef(), "sub", x, y); + return ieee754sp_indef(); case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF): case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF): @@ -179,5 +179,6 @@ union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y) xe--; } } - SPNORMRET2(xs, xe, xm, "sub", x, y); + + return ieee754sp_format(xs, xe, xm); } diff --git a/arch/mips/math-emu/sp_tint.c b/arch/mips/math-emu/sp_tint.c index 690cb5b4cfa8..53f04dc2991e 100644 --- a/arch/mips/math-emu/sp_tint.c +++ b/arch/mips/math-emu/sp_tint.c @@ -40,7 +40,7 @@ int ieee754sp_tint(union ieee754sp x) case IEEE754_CLASS_QNAN: case IEEE754_CLASS_INF: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); + return ieee754si_indef(); case IEEE754_CLASS_ZERO: return 0; case IEEE754_CLASS_DNORM: @@ -54,7 +54,7 @@ int ieee754sp_tint(union ieee754sp x) /* Set invalid. We will only use overflow for floating point overflow */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); + return ieee754si_indef(); } /* oh gawd */ if (xe > SP_FBITS) { @@ -100,7 +100,7 @@ int ieee754sp_tint(union ieee754sp x) if ((xm >> 31) != 0) { /* This can happen after rounding */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754si_xcpt(ieee754si_indef(), "sp_tint", x); + return ieee754si_indef(); } if (round || sticky) ieee754_setcx(IEEE754_INEXACT); diff --git a/arch/mips/math-emu/sp_tlong.c b/arch/mips/math-emu/sp_tlong.c index 346cbad4a1ae..df117923adaa 100644 --- a/arch/mips/math-emu/sp_tlong.c +++ b/arch/mips/math-emu/sp_tlong.c @@ -41,7 +41,7 @@ s64 ieee754sp_tlong(union ieee754sp x) case IEEE754_CLASS_QNAN: case IEEE754_CLASS_INF: ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); + return ieee754di_indef(); case IEEE754_CLASS_ZERO: return 0; case IEEE754_CLASS_DNORM: @@ -55,7 +55,7 @@ s64 ieee754sp_tlong(union ieee754sp x) /* Set invalid. We will only use overflow for floating point overflow */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); + return ieee754di_indef(); } /* oh gawd */ if (xe > SP_FBITS) { @@ -97,7 +97,7 @@ s64 ieee754sp_tlong(union ieee754sp x) if ((xm >> 63) != 0) { /* This can happen after rounding */ ieee754_setcx(IEEE754_INVALID_OPERATION); - return ieee754di_xcpt(ieee754di_indef(), "sp_tlong", x); + return ieee754di_indef(); } if (round || sticky) ieee754_setcx(IEEE754_INEXACT); |