Commit 47fa0c02 authored by Ralf Baechle's avatar Ralf Baechle

MIPS: math-emu: Reformat code according to coding style.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 85c51c51
......@@ -869,14 +869,16 @@ static inline int cop1_64bit(struct pt_regs *xcp)
#endif
}
#define SIFROMREG(si, x) do { \
#define SIFROMREG(si, x) \
do { \
if (cop1_64bit(xcp)) \
(si) = get_fpr32(&ctx->fpr[x], 0); \
else \
(si) = get_fpr32(&ctx->fpr[(x) & ~1], (x) & 1); \
} while (0)
#define SITOREG(si, x) do { \
#define SITOREG(si, x) \
do { \
if (cop1_64bit(xcp)) { \
unsigned i; \
set_fpr32(&ctx->fpr[x], 0, si); \
......@@ -889,7 +891,8 @@ static inline int cop1_64bit(struct pt_regs *xcp)
#define SIFROMHREG(si, x) ((si) = get_fpr32(&ctx->fpr[x], 1))
#define SITOHREG(si, x) do { \
#define SITOHREG(si, x) \
do { \
unsigned i; \
set_fpr32(&ctx->fpr[x], 1, si); \
for (i = 2; i < ARRAY_SIZE(ctx->fpr[x].val32); i++) \
......@@ -899,7 +902,8 @@ static inline int cop1_64bit(struct pt_regs *xcp)
#define DIFROMREG(di, x) \
((di) = get_fpr64(&ctx->fpr[(x) & ~(cop1_64bit(xcp) == 0)], 0))
#define DITOREG(di, x) do { \
#define DITOREG(di, x) \
do { \
unsigned fpr, i; \
fpr = (x) & ~(cop1_64bit(xcp) == 0); \
set_fpr64(&ctx->fpr[fpr], 0, di); \
......@@ -1342,8 +1346,8 @@ static const unsigned char cmptab[8] = {
*/
#define DEF3OP(name, p, f1, f2, f3) \
static union ieee754##p fpemu_##p##_##name(union ieee754##p r, union ieee754##p s, \
union ieee754##p t) \
static union ieee754##p fpemu_##p##_##name(union ieee754##p r, \
union ieee754##p s, union ieee754##p t) \
{ \
struct _ieee754_csr ieee754_csr_save; \
s = f1(s, t); \
......
......@@ -151,12 +151,12 @@ union ieee754dp ieee754dp_format(int sn, int xe, u64 xm)
case IEEE754_RZ:
return ieee754dp_zero(sn);
case IEEE754_RU: /* toward +Infinity */
if(sn == 0)
if (sn == 0)
return ieee754dp_min(0);
else
return ieee754dp_zero(1);
case IEEE754_RD: /* toward -Infinity */
if(sn == 0)
if (sn == 0)
return ieee754dp_zero(0);
else
return ieee754dp_min(1);
......
......@@ -42,7 +42,7 @@
/* convert denormal to normalized with extended exponent */
#define DPDNORMx(m,e) \
while( (m >> DP_MBITS) == 0) { m <<= 1; e--; }
while ((m >> DP_MBITS) == 0) { m <<= 1; e--; }
#define DPDNORMX DPDNORMx(xm, xe)
#define DPDNORMY DPDNORMx(ym, ye)
......@@ -74,7 +74,7 @@ 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(TSTX()) \
if (TSTX()) \
return ieee754dp_xcpt(V, name, a0, a1); \
else \
return V; \
......
......@@ -76,86 +76,86 @@
unsigned ym; int ye; int ys; int yc
#define EXPLODESP(v, vc, vs, ve, vm) \
{\
vs = SPSIGN(v);\
ve = SPBEXP(v);\
vm = SPMANT(v);\
if(ve == SP_EMAX+1+SP_EBIAS){\
if(vm == 0)\
vc = IEEE754_CLASS_INF;\
else if(vm & SP_MBIT(SP_MBITS-1)) \
vc = IEEE754_CLASS_SNAN;\
{ \
vs = SPSIGN(v); \
ve = SPBEXP(v); \
vm = SPMANT(v); \
if (ve == SP_EMAX+1+SP_EBIAS) { \
if (vm == 0) \
vc = IEEE754_CLASS_INF; \
else if (vm & SP_MBIT(SP_MBITS-1)) \
vc = IEEE754_CLASS_SNAN; \
else \
vc = IEEE754_CLASS_QNAN;\
} else if(ve == SP_EMIN-1+SP_EBIAS) {\
if(vm) {\
ve = SP_EMIN;\
vc = IEEE754_CLASS_DNORM;\
} else\
vc = IEEE754_CLASS_ZERO;\
} else {\
ve -= SP_EBIAS;\
vm |= SP_HIDDEN_BIT;\
vc = IEEE754_CLASS_NORM;\
}\
vc = IEEE754_CLASS_QNAN; \
} else if (ve == SP_EMIN-1+SP_EBIAS) { \
if (vm) { \
ve = SP_EMIN; \
vc = IEEE754_CLASS_DNORM; \
} else \
vc = IEEE754_CLASS_ZERO; \
} else { \
ve -= SP_EBIAS; \
vm |= SP_HIDDEN_BIT; \
vc = IEEE754_CLASS_NORM; \
} \
}
#define EXPLODEXSP EXPLODESP(x, xc, xs, xe, xm)
#define EXPLODEYSP EXPLODESP(y, yc, ys, ye, ym)
#define COMPXDP \
u64 xm; int xe; int xs __maybe_unused; int xc
u64 xm; int xe; int xs __maybe_unused; int xc
#define COMPYDP \
u64 ym; int ye; int ys; int yc
u64 ym; int ye; int ys; int yc
#define EXPLODEDP(v, vc, vs, ve, vm) \
{\
vm = DPMANT(v);\
vs = DPSIGN(v);\
ve = DPBEXP(v);\
if(ve == DP_EMAX+1+DP_EBIAS){\
if(vm == 0)\
vc = IEEE754_CLASS_INF;\
else if(vm & DP_MBIT(DP_MBITS-1)) \
vc = IEEE754_CLASS_SNAN;\
{ \
vm = DPMANT(v); \
vs = DPSIGN(v); \
ve = DPBEXP(v); \
if (ve == DP_EMAX+1+DP_EBIAS) { \
if (vm == 0) \
vc = IEEE754_CLASS_INF; \
else if (vm & DP_MBIT(DP_MBITS-1)) \
vc = IEEE754_CLASS_SNAN; \
else \
vc = IEEE754_CLASS_QNAN;\
} else if(ve == DP_EMIN-1+DP_EBIAS) {\
if(vm) {\
ve = DP_EMIN;\
vc = IEEE754_CLASS_DNORM;\
} else\
vc = IEEE754_CLASS_ZERO;\
} else {\
ve -= DP_EBIAS;\
vm |= DP_HIDDEN_BIT;\
vc = IEEE754_CLASS_NORM;\
}\
vc = IEEE754_CLASS_QNAN; \
} else if (ve == DP_EMIN-1+DP_EBIAS) { \
if (vm) { \
ve = DP_EMIN; \
vc = IEEE754_CLASS_DNORM; \
} else \
vc = IEEE754_CLASS_ZERO; \
} else { \
ve -= DP_EBIAS; \
vm |= DP_HIDDEN_BIT; \
vc = IEEE754_CLASS_NORM; \
} \
}
#define EXPLODEXDP EXPLODEDP(x, xc, xs, xe, xm)
#define EXPLODEYDP EXPLODEDP(y, yc, ys, ye, ym)
#define FLUSHDP(v, vc, vs, ve, vm) \
if(vc==IEEE754_CLASS_DNORM) {\
if(ieee754_csr.nod) {\
SETCX(IEEE754_INEXACT);\
vc = IEEE754_CLASS_ZERO;\
ve = DP_EMIN-1+DP_EBIAS;\
vm = 0;\
v = ieee754dp_zero(vs);\
}\
if (vc==IEEE754_CLASS_DNORM) { \
if (ieee754_csr.nod) { \
SETCX(IEEE754_INEXACT); \
vc = IEEE754_CLASS_ZERO; \
ve = DP_EMIN-1+DP_EBIAS; \
vm = 0; \
v = ieee754dp_zero(vs); \
} \
}
#define FLUSHSP(v, vc, vs, ve, vm) \
if(vc==IEEE754_CLASS_DNORM) {\
if(ieee754_csr.nod) {\
SETCX(IEEE754_INEXACT);\
vc = IEEE754_CLASS_ZERO;\
ve = SP_EMIN-1+SP_EBIAS;\
vm = 0;\
v = ieee754sp_zero(vs);\
}\
if (vc==IEEE754_CLASS_DNORM) { \
if (ieee754_csr.nod) { \
SETCX(IEEE754_INEXACT); \
vc = IEEE754_CLASS_ZERO; \
ve = SP_EMIN-1+SP_EBIAS; \
vm = 0; \
v = ieee754sp_zero(vs); \
} \
}
#define FLUSHXDP FLUSHDP(x, xc, xs, xe, xm)
......
......@@ -152,12 +152,12 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
case IEEE754_RZ:
return ieee754sp_zero(sn);
case IEEE754_RU: /* toward +Infinity */
if(sn == 0)
if (sn == 0)
return ieee754sp_min(0);
else
return ieee754sp_zero(1);
case IEEE754_RD: /* toward -Infinity */
if(sn == 0)
if (sn == 0)
return ieee754sp_zero(0);
else
return ieee754sp_min(1);
......@@ -174,8 +174,7 @@ union ieee754sp ieee754sp_format(int sn, int xe, unsigned xm)
/* Clear grs bits */
xm &= ~(SP_MBIT(3) - 1);
xe++;
}
else {
} else {
/* sticky right shift es bits
*/
SPXSRSXn(es);
......
......@@ -47,7 +47,7 @@
/* convert denormal to normalized with extended exponent */
#define SPDNORMx(m,e) \
while( (m >> SP_MBITS) == 0) { m <<= 1; e--; }
while ((m >> SP_MBITS) == 0) { m <<= 1; e--; }
#define SPDNORMX SPDNORMx(xm, xe)
#define SPDNORMY SPDNORMx(ym, ye)
......@@ -80,7 +80,8 @@ 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(TSTX()) \
\
if (TSTX()) \
return ieee754sp_xcpt(V, name, a0, a1); \
else \
return V; \
......
......@@ -38,14 +38,17 @@ static int __init debugfs_fpuemu(void)
if (!dir)
return -ENOMEM;
#define FPU_STAT_CREATE(M) \
do { \
d = debugfs_create_file(#M , S_IRUGO, dir, \
(void *)offsetof(struct mips_fpu_emulator_stats, M), \
#define FPU_EMU_STAT_OFFSET(m) \
offsetof(struct mips_fpu_emulator_stats, m)
#define FPU_STAT_CREATE(m) \
do { \
d = debugfs_create_file(#m , S_IRUGO, dir, \
(void *)FPU_EMU_STAT_OFFSET(m), \
&fops_fpuemu_stat); \
if (!d) \
return -ENOMEM; \
} while (0)
} while (0)
FPU_STAT_CREATE(emulated);
FPU_STAT_CREATE(loads);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment