Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
47fa0c02
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
47fa0c02
编写于
4月 16, 2014
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MIPS: math-emu: Reformat code according to coding style.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
85c51c51
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
140 addition
and
133 deletion
+140
-133
arch/mips/math-emu/cp1emu.c
arch/mips/math-emu/cp1emu.c
+23
-19
arch/mips/math-emu/ieee754dp.c
arch/mips/math-emu/ieee754dp.c
+2
-2
arch/mips/math-emu/ieee754dp.h
arch/mips/math-emu/ieee754dp.h
+11
-11
arch/mips/math-emu/ieee754int.h
arch/mips/math-emu/ieee754int.h
+73
-73
arch/mips/math-emu/ieee754sp.c
arch/mips/math-emu/ieee754sp.c
+3
-4
arch/mips/math-emu/ieee754sp.h
arch/mips/math-emu/ieee754sp.h
+17
-16
arch/mips/math-emu/me-debugfs.c
arch/mips/math-emu/me-debugfs.c
+11
-8
未找到文件。
arch/mips/math-emu/cp1emu.c
浏览文件 @
47fa0c02
...
...
@@ -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,17 +891,19 @@ 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++) \
set_fpr32(&ctx->fpr[x], i, 0); \
} while (0)
#define DIFROMREG(di, x)
\
#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); \
...
...
@@ -1341,20 +1345,20 @@ static const unsigned char cmptab[8] = {
* Additional MIPS4 instructions
*/
#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)
\
{
\
struct _ieee754_csr ieee754_csr_save;
\
s = f1(s, t);
\
ieee754_csr_save = ieee754_csr;
\
s = f2(s, r);
\
ieee754_csr_save.cx |= ieee754_csr.cx;
\
ieee754_csr_save.sx |= ieee754_csr.sx;
\
s = f3(s);
\
ieee754_csr.cx |= ieee754_csr_save.cx;
\
ieee754_csr.sx |= ieee754_csr_save.sx;
\
return s;
\
#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)
\
{
\
struct _ieee754_csr ieee754_csr_save;
\
s = f1(s, t);
\
ieee754_csr_save = ieee754_csr;
\
s = f2(s, r);
\
ieee754_csr_save.cx |= ieee754_csr.cx;
\
ieee754_csr_save.sx |= ieee754_csr.sx;
\
s = f3(s);
\
ieee754_csr.cx |= ieee754_csr_save.cx;
\
ieee754_csr.sx |= ieee754_csr_save.sx;
\
return s;
\
}
static
union
ieee754dp
fpemu_dp_recip
(
union
ieee754dp
d
)
...
...
arch/mips/math-emu/ieee754dp.c
浏览文件 @
47fa0c02
...
...
@@ -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
);
...
...
arch/mips/math-emu/ieee754dp.h
浏览文件 @
47fa0c02
...
...
@@ -32,17 +32,17 @@
/* 3bit extended double precision sticky right shift */
#define XDPSRS(v,rs) \
((rs > (DP_MBITS+3))?1:((v) >> (rs)) | ((v) << (64-(rs)) != 0))
((rs > (DP_MBITS+3))?1:((v) >> (rs)) | ((v) << (64-(rs)) != 0))
#define XDPSRSX1() \
(xe++, (xm = (xm >> 1) | (xm & 1)))
(xe++, (xm = (xm >> 1) | (xm & 1)))
#define XDPSRS1(v) \
(((v) >> 1) | ((v) & 1))
(((v) >> 1) | ((v) & 1))
/* 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)
...
...
@@ -71,13 +71,13 @@ extern union ieee754dp ieee754dp_bestnan(union ieee754dp, 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(TSTX())
\
return ieee754dp_xcpt(V, name, a0, a1);
\
else
\
return V;
\
#define DPNORMRET2(s, e, m, name, a0, a1)
\
{
\
union ieee754dp V = ieee754dp_format(s, e, m);
\
if (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)
arch/mips/math-emu/ieee754int.h
浏览文件 @
47fa0c02
...
...
@@ -57,105 +57,105 @@
#define CLPAIR(x, y) ((x)*6+(y))
#define CLEARCX \
(ieee754_csr.cx = 0)
(ieee754_csr.cx = 0)
#define SETCX(x) \
(ieee754_csr.cx |= (x), ieee754_csr.sx |= (x))
(ieee754_csr.cx |= (x), ieee754_csr.sx |= (x))
#define SETANDTESTCX(x) \
(SETCX(x), ieee754_csr.mx & (x))
(SETCX(x), ieee754_csr.mx & (x))
#define TSTX() \
(ieee754_csr.cx & ieee754_csr.mx)
#define COMPXSP \
unsigned xm; int xe; int xs __maybe_unused; int xc
unsigned xm; int xe; int xs __maybe_unused; int xc
#define COMPYSP \
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;
\
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;
\
}
\
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;
\
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;
\
}
\
}
#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
#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;
\
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;
\
}
\
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;
\
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;
\
}
\
}
#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);
\
}
\
#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);
\
}
\
}
#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);
\
}
\
#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);
\
}
\
}
#define FLUSHXDP FLUSHDP(x, xc, xs, xe, xm)
...
...
arch/mips/math-emu/ieee754sp.c
浏览文件 @
47fa0c02
...
...
@@ -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
);
...
...
arch/mips/math-emu/ieee754sp.h
浏览文件 @
47fa0c02
...
...
@@ -31,23 +31,23 @@
#define assert(expr) ((void)0)
/* 3bit extended single precision sticky right shift */
#define SPXSRSXn(rs)
\
(xe += rs,
\
xm = (rs > (SP_MBITS+3))?1:((xm) >> (rs)) | ((xm) << (32-(rs)) != 0))
#define SPXSRSXn(rs)
\
(xe += rs,
\
xm = (rs > (SP_MBITS+3))?1:((xm) >> (rs)) | ((xm) << (32-(rs)) != 0))
#define SPXSRSX1() \
(xe++, (xm = (xm >> 1) | (xm & 1)))
(xe++, (xm = (xm >> 1) | (xm & 1)))
#define SPXSRSYn(rs)
\
(ye+=rs,
\
ym = (rs > (SP_MBITS+3))?1:((ym) >> (rs)) | ((ym) << (32-(rs)) != 0))
#define SPXSRSYn(rs)
\
(ye+=rs,
\
ym = (rs > (SP_MBITS+3))?1:((ym) >> (rs)) | ((ym) << (32-(rs)) != 0))
#define SPXSRSY1() \
(ye++, (ym = (ym >> 1) | (ym & 1)))
(ye++, (ym = (ym >> 1) | (ym & 1)))
/* 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)
...
...
@@ -77,13 +77,14 @@ extern union ieee754sp ieee754sp_bestnan(union ieee754sp, 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(TSTX()) \
return ieee754sp_xcpt(V, name, a0, a1); \
else \
return V; \
#define SPNORMRET2(s, e, m, name, a0, a1) \
{ \
union ieee754sp V = ieee754sp_format(s, e, m); \
\
if (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)
arch/mips/math-emu/me-debugfs.c
浏览文件 @
47fa0c02
...
...
@@ -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), \
&fops_fpuemu_stat); \
if (!d) \
return -ENOMEM; \
} while (0)
#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)
FPU_STAT_CREATE
(
emulated
);
FPU_STAT_CREATE
(
loads
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录