Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
2209bcb1
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2209bcb1
编写于
4月 16, 2014
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MIPS: math-emu: Get rid of typedefs.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
23708818
变更
40
隐藏空白更改
内联
并排
Showing
40 changed file
with
212 addition
and
212 deletion
+212
-212
arch/mips/math-emu/cp1emu.c
arch/mips/math-emu/cp1emu.c
+33
-33
arch/mips/math-emu/dp_add.c
arch/mips/math-emu/dp_add.c
+1
-1
arch/mips/math-emu/dp_cmp.c
arch/mips/math-emu/dp_cmp.c
+1
-1
arch/mips/math-emu/dp_div.c
arch/mips/math-emu/dp_div.c
+1
-1
arch/mips/math-emu/dp_fint.c
arch/mips/math-emu/dp_fint.c
+2
-2
arch/mips/math-emu/dp_flong.c
arch/mips/math-emu/dp_flong.c
+2
-2
arch/mips/math-emu/dp_frexp.c
arch/mips/math-emu/dp_frexp.c
+1
-1
arch/mips/math-emu/dp_fsp.c
arch/mips/math-emu/dp_fsp.c
+1
-1
arch/mips/math-emu/dp_logb.c
arch/mips/math-emu/dp_logb.c
+1
-1
arch/mips/math-emu/dp_modf.c
arch/mips/math-emu/dp_modf.c
+1
-1
arch/mips/math-emu/dp_mul.c
arch/mips/math-emu/dp_mul.c
+1
-1
arch/mips/math-emu/dp_scalb.c
arch/mips/math-emu/dp_scalb.c
+2
-2
arch/mips/math-emu/dp_simple.c
arch/mips/math-emu/dp_simple.c
+5
-5
arch/mips/math-emu/dp_sqrt.c
arch/mips/math-emu/dp_sqrt.c
+2
-2
arch/mips/math-emu/dp_sub.c
arch/mips/math-emu/dp_sub.c
+1
-1
arch/mips/math-emu/dp_tint.c
arch/mips/math-emu/dp_tint.c
+3
-3
arch/mips/math-emu/dp_tlong.c
arch/mips/math-emu/dp_tlong.c
+3
-3
arch/mips/math-emu/ieee754.h
arch/mips/math-emu/ieee754.h
+83
-83
arch/mips/math-emu/ieee754d.c
arch/mips/math-emu/ieee754d.c
+2
-2
arch/mips/math-emu/ieee754dp.c
arch/mips/math-emu/ieee754dp.c
+7
-7
arch/mips/math-emu/ieee754dp.h
arch/mips/math-emu/ieee754dp.h
+9
-9
arch/mips/math-emu/ieee754m.c
arch/mips/math-emu/ieee754m.c
+6
-6
arch/mips/math-emu/ieee754sp.c
arch/mips/math-emu/ieee754sp.c
+7
-7
arch/mips/math-emu/ieee754sp.h
arch/mips/math-emu/ieee754sp.h
+9
-9
arch/mips/math-emu/sp_add.c
arch/mips/math-emu/sp_add.c
+1
-1
arch/mips/math-emu/sp_cmp.c
arch/mips/math-emu/sp_cmp.c
+1
-1
arch/mips/math-emu/sp_div.c
arch/mips/math-emu/sp_div.c
+1
-1
arch/mips/math-emu/sp_fdp.c
arch/mips/math-emu/sp_fdp.c
+2
-2
arch/mips/math-emu/sp_fint.c
arch/mips/math-emu/sp_fint.c
+2
-2
arch/mips/math-emu/sp_flong.c
arch/mips/math-emu/sp_flong.c
+2
-2
arch/mips/math-emu/sp_frexp.c
arch/mips/math-emu/sp_frexp.c
+1
-1
arch/mips/math-emu/sp_logb.c
arch/mips/math-emu/sp_logb.c
+1
-1
arch/mips/math-emu/sp_modf.c
arch/mips/math-emu/sp_modf.c
+1
-1
arch/mips/math-emu/sp_mul.c
arch/mips/math-emu/sp_mul.c
+1
-1
arch/mips/math-emu/sp_scalb.c
arch/mips/math-emu/sp_scalb.c
+2
-2
arch/mips/math-emu/sp_simple.c
arch/mips/math-emu/sp_simple.c
+5
-5
arch/mips/math-emu/sp_sqrt.c
arch/mips/math-emu/sp_sqrt.c
+1
-1
arch/mips/math-emu/sp_sub.c
arch/mips/math-emu/sp_sub.c
+1
-1
arch/mips/math-emu/sp_tint.c
arch/mips/math-emu/sp_tint.c
+3
-3
arch/mips/math-emu/sp_tlong.c
arch/mips/math-emu/sp_tlong.c
+3
-3
未找到文件。
arch/mips/math-emu/cp1emu.c
浏览文件 @
2209bcb1
...
...
@@ -1349,8 +1349,8 @@ static const unsigned char cmptab[8] = {
*/
#define DEF3OP(name, p, f1, f2, f3) \
static
ieee754##p fpemu_##p##_##name(ieee754##p r,
ieee754##p s, \
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); \
...
...
@@ -1364,22 +1364,22 @@ static ieee754##p fpemu_##p##_##name(ieee754##p r, ieee754##p s, \
return s; \
}
static
ieee754dp
fpemu_dp_recip
(
ieee754dp
d
)
static
union
ieee754dp
fpemu_dp_recip
(
union
ieee754dp
d
)
{
return
ieee754dp_div
(
ieee754dp_one
(
0
),
d
);
}
static
ieee754dp
fpemu_dp_rsqrt
(
ieee754dp
d
)
static
union
ieee754dp
fpemu_dp_rsqrt
(
union
ieee754dp
d
)
{
return
ieee754dp_div
(
ieee754dp_one
(
0
),
ieee754dp_sqrt
(
d
));
}
static
ieee754sp
fpemu_sp_recip
(
ieee754sp
s
)
static
union
ieee754sp
fpemu_sp_recip
(
union
ieee754sp
s
)
{
return
ieee754sp_div
(
ieee754sp_one
(
0
),
s
);
}
static
ieee754sp
fpemu_sp_rsqrt
(
ieee754sp
s
)
static
union
ieee754sp
fpemu_sp_rsqrt
(
union
ieee754sp
s
)
{
return
ieee754sp_div
(
ieee754sp_one
(
0
),
ieee754sp_sqrt
(
s
));
}
...
...
@@ -1403,8 +1403,8 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
switch
(
MIPSInst_FMA_FFMT
(
ir
))
{
case
s_fmt
:{
/* 0 */
ieee754sp
(
*
handler
)
(
ieee754sp
,
ieee754sp
,
ieee754sp
);
ieee754sp
fd
,
fr
,
fs
,
ft
;
union
ieee754sp
(
*
handler
)
(
union
ieee754sp
,
union
ieee754sp
,
union
ieee754sp
);
union
ieee754sp
fd
,
fr
,
fs
,
ft
;
u32
__user
*
va
;
u32
val
;
...
...
@@ -1492,8 +1492,8 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
}
case
d_fmt
:{
/* 1 */
ieee754dp
(
*
handler
)
(
ieee754dp
,
ieee754dp
,
ieee754dp
);
ieee754dp
fd
,
fr
,
fs
,
ft
;
union
ieee754dp
(
*
handler
)
(
union
ieee754dp
,
union
ieee754dp
,
union
ieee754dp
);
union
ieee754dp
fd
,
fr
,
fs
,
ft
;
u64
__user
*
va
;
u64
val
;
...
...
@@ -1588,8 +1588,8 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
unsigned
rcsr
=
0
;
/* resulting csr */
unsigned
cond
;
union
{
ieee754dp
d
;
ieee754sp
s
;
union
ieee754dp
d
;
union
ieee754sp
s
;
int
w
;
#ifdef __mips64
s64
l
;
...
...
@@ -1600,8 +1600,8 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
switch
(
rfmt
=
(
MIPSInst_FFMT
(
ir
)
&
0xf
))
{
case
s_fmt
:{
/* 0 */
union
{
ieee754sp
(
*
b
)
(
ieee754sp
,
ieee754sp
);
ieee754sp
(
*
u
)
(
ieee754sp
);
union
ieee754sp
(
*
b
)
(
union
ieee754sp
,
union
ieee754sp
);
union
ieee754sp
(
*
u
)
(
union
ieee754sp
);
}
handler
;
switch
(
MIPSInst_FUNC
(
ir
))
{
...
...
@@ -1666,7 +1666,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
/* binary op on handler */
scopbop:
{
ieee754sp
fs
,
ft
;
union
ieee754sp
fs
,
ft
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
SPFROMREG
(
ft
,
MIPSInst_FT
(
ir
));
...
...
@@ -1676,7 +1676,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
}
scopuop:
{
ieee754sp
fs
;
union
ieee754sp
fs
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
s
=
(
*
handler
.
u
)
(
fs
);
...
...
@@ -1699,7 +1699,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
case
fcvts_op
:
return
SIGILL
;
/* not defined */
case
fcvtd_op
:{
ieee754sp
fs
;
union
ieee754sp
fs
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
d
=
ieee754dp_fsp
(
fs
);
...
...
@@ -1707,7 +1707,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
goto
copcsr
;
}
case
fcvtw_op
:{
ieee754sp
fs
;
union
ieee754sp
fs
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
w
=
ieee754sp_tint
(
fs
);
...
...
@@ -1721,7 +1721,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
case
fceil_op
:
case
ffloor_op
:{
unsigned
int
oldrm
=
ieee754_csr
.
rm
;
ieee754sp
fs
;
union
ieee754sp
fs
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
ieee754_csr
.
rm
=
ieee_rm
[
modeindex
(
MIPSInst_FUNC
(
ir
))];
...
...
@@ -1734,7 +1734,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
#if defined(__mips64)
case
fcvtl_op
:{
ieee754sp
fs
;
union
ieee754sp
fs
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
l
=
ieee754sp_tlong
(
fs
);
...
...
@@ -1747,7 +1747,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
case
fceill_op
:
case
ffloorl_op
:{
unsigned
int
oldrm
=
ieee754_csr
.
rm
;
ieee754sp
fs
;
union
ieee754sp
fs
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
ieee754_csr
.
rm
=
ieee_rm
[
modeindex
(
MIPSInst_FUNC
(
ir
))];
...
...
@@ -1761,7 +1761,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
default:
if
(
MIPSInst_FUNC
(
ir
)
>=
fcmp_op
)
{
unsigned
cmpop
=
MIPSInst_FUNC
(
ir
)
-
fcmp_op
;
ieee754sp
fs
,
ft
;
union
ieee754sp
fs
,
ft
;
SPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
SPFROMREG
(
ft
,
MIPSInst_FT
(
ir
));
...
...
@@ -1785,8 +1785,8 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
case
d_fmt
:{
union
{
ieee754dp
(
*
b
)
(
ieee754dp
,
ieee754dp
);
ieee754dp
(
*
u
)
(
ieee754dp
);
union
ieee754dp
(
*
b
)
(
union
ieee754dp
,
union
ieee754dp
);
union
ieee754dp
(
*
u
)
(
union
ieee754dp
);
}
handler
;
switch
(
MIPSInst_FUNC
(
ir
))
{
...
...
@@ -1852,7 +1852,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
/* binary op on handler */
dcopbop:
{
ieee754dp
fs
,
ft
;
union
ieee754dp
fs
,
ft
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
DPFROMREG
(
ft
,
MIPSInst_FT
(
ir
));
...
...
@@ -1861,7 +1861,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
goto
copcsr
;
}
dcopuop:
{
ieee754dp
fs
;
union
ieee754dp
fs
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
d
=
(
*
handler
.
u
)
(
fs
);
...
...
@@ -1870,7 +1870,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
/* unary conv ops */
case
fcvts_op
:{
ieee754dp
fs
;
union
ieee754dp
fs
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
s
=
ieee754sp_fdp
(
fs
);
...
...
@@ -1881,7 +1881,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
return
SIGILL
;
/* not defined */
case
fcvtw_op
:{
ieee754dp
fs
;
union
ieee754dp
fs
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
w
=
ieee754dp_tint
(
fs
);
/* wrong */
...
...
@@ -1895,7 +1895,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
case
fceil_op
:
case
ffloor_op
:{
unsigned
int
oldrm
=
ieee754_csr
.
rm
;
ieee754dp
fs
;
union
ieee754dp
fs
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
ieee754_csr
.
rm
=
ieee_rm
[
modeindex
(
MIPSInst_FUNC
(
ir
))];
...
...
@@ -1908,7 +1908,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
#if defined(__mips64)
case
fcvtl_op
:{
ieee754dp
fs
;
union
ieee754dp
fs
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
rv
.
l
=
ieee754dp_tlong
(
fs
);
...
...
@@ -1921,7 +1921,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
case
fceill_op
:
case
ffloorl_op
:{
unsigned
int
oldrm
=
ieee754_csr
.
rm
;
ieee754dp
fs
;
union
ieee754dp
fs
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
ieee754_csr
.
rm
=
ieee_rm
[
modeindex
(
MIPSInst_FUNC
(
ir
))];
...
...
@@ -1935,7 +1935,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
default:
if
(
MIPSInst_FUNC
(
ir
)
>=
fcmp_op
)
{
unsigned
cmpop
=
MIPSInst_FUNC
(
ir
)
-
fcmp_op
;
ieee754dp
fs
,
ft
;
union
ieee754dp
fs
,
ft
;
DPFROMREG
(
fs
,
MIPSInst_FS
(
ir
));
DPFROMREG
(
ft
,
MIPSInst_FT
(
ir
));
...
...
@@ -1960,7 +1960,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
}
case
w_fmt
:{
ieee754sp
fs
;
union
ieee754sp
fs
;
switch
(
MIPSInst_FUNC
(
ir
))
{
case
fcvts_op
:
...
...
arch/mips/math-emu/dp_add.c
浏览文件 @
2209bcb1
...
...
@@ -27,7 +27,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_add
(
ieee754dp
x
,
ieee754dp
y
)
union
ieee754dp
ieee754dp_add
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
COMPXDP
;
COMPYDP
;
...
...
arch/mips/math-emu/dp_cmp.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
int
ieee754dp_cmp
(
ieee754dp
x
,
ieee754dp
y
,
int
cmp
,
int
sig
)
int
ieee754dp_cmp
(
union
ieee754dp
x
,
union
ieee754dp
y
,
int
cmp
,
int
sig
)
{
COMPXDP
;
COMPYDP
;
...
...
arch/mips/math-emu/dp_div.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_div
(
ieee754dp
x
,
ieee754dp
y
)
union
ieee754dp
ieee754dp_div
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
COMPXDP
;
COMPYDP
;
...
...
arch/mips/math-emu/dp_fint.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_fint
(
int
x
)
union
ieee754dp
ieee754dp_fint
(
int
x
)
{
u64
xm
;
int
xe
;
...
...
@@ -70,7 +70,7 @@ ieee754dp ieee754dp_fint(int x)
#endif
}
ieee754dp
ieee754dp_funs
(
unsigned
int
u
)
union
ieee754dp
ieee754dp_funs
(
unsigned
int
u
)
{
if
((
int
)
u
<
0
)
return
ieee754dp_add
(
ieee754dp_1e31
(),
...
...
arch/mips/math-emu/dp_flong.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_flong
(
s64
x
)
union
ieee754dp
ieee754dp_flong
(
s64
x
)
{
u64
xm
;
int
xe
;
...
...
@@ -68,7 +68,7 @@ ieee754dp ieee754dp_flong(s64 x)
DPNORMRET1
(
xs
,
xe
,
xm
,
"dp_flong"
,
x
);
}
ieee754dp
ieee754dp_fulong
(
u64
u
)
union
ieee754dp
ieee754dp_fulong
(
u64
u
)
{
if
((
s64
)
u
<
0
)
return
ieee754dp_add
(
ieee754dp_1e63
(),
...
...
arch/mips/math-emu/dp_frexp.c
浏览文件 @
2209bcb1
...
...
@@ -28,7 +28,7 @@
/* close to ieeep754dp_logb
*/
ieee754dp
ieee754dp_frexp
(
ieee754dp
x
,
int
*
eptr
)
union
ieee754dp
ieee754dp_frexp
(
union
ieee754dp
x
,
int
*
eptr
)
{
COMPXDP
;
CLEARCX
;
...
...
arch/mips/math-emu/dp_fsp.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_fsp
(
ieee754sp
x
)
union
ieee754dp
ieee754dp_fsp
(
union
ieee754sp
x
)
{
COMPXSP
;
...
...
arch/mips/math-emu/dp_logb.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_logb
(
ieee754dp
x
)
union
ieee754dp
ieee754dp_logb
(
union
ieee754dp
x
)
{
COMPXDP
;
...
...
arch/mips/math-emu/dp_modf.c
浏览文件 @
2209bcb1
...
...
@@ -28,7 +28,7 @@
/* modf function is always exact for a finite number
*/
ieee754dp
ieee754dp_modf
(
ieee754dp
x
,
ieee754dp
*
ip
)
union
ieee754dp
ieee754dp_modf
(
union
ieee754dp
x
,
union
ieee754dp
*
ip
)
{
COMPXDP
;
...
...
arch/mips/math-emu/dp_mul.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_mul
(
ieee754dp
x
,
ieee754dp
y
)
union
ieee754dp
ieee754dp_mul
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
COMPXDP
;
COMPYDP
;
...
...
arch/mips/math-emu/dp_scalb.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_scalb
(
ieee754dp
x
,
int
n
)
union
ieee754dp
ieee754dp_scalb
(
union
ieee754dp
x
,
int
n
)
{
COMPXDP
;
...
...
@@ -51,7 +51,7 @@ ieee754dp ieee754dp_scalb(ieee754dp x, int n)
}
ieee754dp
ieee754dp_ldexp
(
ieee754dp
x
,
int
n
)
union
ieee754dp
ieee754dp_ldexp
(
union
ieee754dp
x
,
int
n
)
{
return
ieee754dp_scalb
(
x
,
n
);
}
arch/mips/math-emu/dp_simple.c
浏览文件 @
2209bcb1
...
...
@@ -26,12 +26,12 @@
#include "ieee754dp.h"
int
ieee754dp_finite
(
ieee754dp
x
)
int
ieee754dp_finite
(
union
ieee754dp
x
)
{
return
DPBEXP
(
x
)
!=
DP_EMAX
+
1
+
DP_EBIAS
;
}
ieee754dp
ieee754dp_copysign
(
ieee754dp
x
,
ieee754dp
y
)
union
ieee754dp
ieee754dp_copysign
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
CLEARCX
;
DPSIGN
(
x
)
=
DPSIGN
(
y
);
...
...
@@ -39,7 +39,7 @@ ieee754dp ieee754dp_copysign(ieee754dp x, ieee754dp y)
}
ieee754dp
ieee754dp_neg
(
ieee754dp
x
)
union
ieee754dp
ieee754dp_neg
(
union
ieee754dp
x
)
{
COMPXDP
;
...
...
@@ -55,7 +55,7 @@ ieee754dp ieee754dp_neg(ieee754dp x)
DPSIGN
(
x
)
^=
1
;
if
(
xc
==
IEEE754_CLASS_SNAN
)
{
ieee754dp
y
=
ieee754dp_indef
();
union
ieee754dp
y
=
ieee754dp_indef
();
SETCX
(
IEEE754_INVALID_OPERATION
);
DPSIGN
(
y
)
=
DPSIGN
(
x
);
return
ieee754dp_nanxcpt
(
y
,
"neg"
);
...
...
@@ -65,7 +65,7 @@ ieee754dp ieee754dp_neg(ieee754dp x)
}
ieee754dp
ieee754dp_abs
(
ieee754dp
x
)
union
ieee754dp
ieee754dp_abs
(
union
ieee754dp
x
)
{
COMPXDP
;
...
...
arch/mips/math-emu/dp_sqrt.c
浏览文件 @
2209bcb1
...
...
@@ -34,10 +34,10 @@ static const unsigned table[] = {
1742
,
661
,
130
};
ieee754dp
ieee754dp_sqrt
(
ieee754dp
x
)
union
ieee754dp
ieee754dp_sqrt
(
union
ieee754dp
x
)
{
struct
_ieee754_csr
oldcsr
;
ieee754dp
y
,
z
,
t
;
union
ieee754dp
y
,
z
,
t
;
unsigned
scalx
,
yh
;
COMPXDP
;
...
...
arch/mips/math-emu/dp_sub.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
ieee754dp
ieee754dp_sub
(
ieee754dp
x
,
ieee754dp
y
)
union
ieee754dp
ieee754dp_sub
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
COMPXDP
;
COMPYDP
;
...
...
arch/mips/math-emu/dp_tint.c
浏览文件 @
2209bcb1
...
...
@@ -27,7 +27,7 @@
#include <linux/kernel.h>
#include "ieee754dp.h"
int
ieee754dp_tint
(
ieee754dp
x
)
int
ieee754dp_tint
(
union
ieee754dp
x
)
{
COMPXDP
;
...
...
@@ -109,9 +109,9 @@ int ieee754dp_tint(ieee754dp x)
}
unsigned
int
ieee754dp_tuns
(
ieee754dp
x
)
unsigned
int
ieee754dp_tuns
(
union
ieee754dp
x
)
{
ieee754dp
hb
=
ieee754dp_1e31
();
union
ieee754dp
hb
=
ieee754dp_1e31
();
/* what if x < 0 ?? */
if
(
ieee754dp_lt
(
x
,
hb
))
...
...
arch/mips/math-emu/dp_tlong.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754dp.h"
s64
ieee754dp_tlong
(
ieee754dp
x
)
s64
ieee754dp_tlong
(
union
ieee754dp
x
)
{
COMPXDP
;
...
...
@@ -112,9 +112,9 @@ s64 ieee754dp_tlong(ieee754dp x)
}
u64
ieee754dp_tulong
(
ieee754dp
x
)
u64
ieee754dp_tulong
(
union
ieee754dp
x
)
{
ieee754dp
hb
=
ieee754dp_1e63
();
union
ieee754dp
hb
=
ieee754dp_1e63
();
/* what if x < 0 ?? */
if
(
ieee754dp_lt
(
x
,
hb
))
...
...
arch/mips/math-emu/ieee754.h
浏览文件 @
2209bcb1
...
...
@@ -46,7 +46,7 @@ struct ieee754dp_const {
;))))
};
typedef
union
_
ieee754dp
{
union
ieee754dp
{
struct
ieee754dp_const
oparts
;
struct
{
__BITFIELD_FIELD
(
unsigned
int
sign
:
1
,
...
...
@@ -56,7 +56,7 @@ typedef union _ieee754dp {
}
parts
;
double
d
;
u64
bits
;
}
ieee754dp
;
};
struct
ieee754sp_const
{
__BITFIELD_FIELD
(
unsigned
sign
:
1
,
...
...
@@ -65,106 +65,106 @@ struct ieee754sp_const {
;)))
};
typedef
union
_
ieee754sp
{
union
ieee754sp
{
struct
ieee754sp_const
parts
;
float
f
;
u32
bits
;
}
ieee754sp
;
};
/*
* single precision (often aka float)
*/
int
ieee754sp_finite
(
ieee754sp
x
);
int
ieee754sp_class
(
ieee754sp
x
);
int
ieee754sp_finite
(
union
ieee754sp
x
);
int
ieee754sp_class
(
union
ieee754sp
x
);
ieee754sp
ieee754sp_abs
(
ieee754sp
x
);
ieee754sp
ieee754sp_neg
(
ieee754sp
x
);
ieee754sp
ieee754sp_scalb
(
ieee754sp
x
,
int
);
ieee754sp
ieee754sp_logb
(
ieee754sp
x
);
union
ieee754sp
ieee754sp_abs
(
union
ieee754sp
x
);
union
ieee754sp
ieee754sp_neg
(
union
ieee754sp
x
);
union
ieee754sp
ieee754sp_scalb
(
union
ieee754sp
x
,
int
);
union
ieee754sp
ieee754sp_logb
(
union
ieee754sp
x
);
/* x with sign of y */
ieee754sp
ieee754sp_copysign
(
ieee754sp
x
,
ieee754sp
y
);
union
ieee754sp
ieee754sp_copysign
(
union
ieee754sp
x
,
union
ieee754sp
y
);
ieee754sp
ieee754sp_add
(
ieee754sp
x
,
ieee754sp
y
);
ieee754sp
ieee754sp_sub
(
ieee754sp
x
,
ieee754sp
y
);
ieee754sp
ieee754sp_mul
(
ieee754sp
x
,
ieee754sp
y
);
ieee754sp
ieee754sp_div
(
ieee754sp
x
,
ieee754sp
y
);
union
ieee754sp
ieee754sp_add
(
union
ieee754sp
x
,
union
ieee754sp
y
);
union
ieee754sp
ieee754sp_sub
(
union
ieee754sp
x
,
union
ieee754sp
y
);
union
ieee754sp
ieee754sp_mul
(
union
ieee754sp
x
,
union
ieee754sp
y
);
union
ieee754sp
ieee754sp_div
(
union
ieee754sp
x
,
union
ieee754sp
y
);
ieee754sp
ieee754sp_fint
(
int
x
);
ieee754sp
ieee754sp_funs
(
unsigned
x
);
ieee754sp
ieee754sp_flong
(
s64
x
);
ieee754sp
ieee754sp_fulong
(
u64
x
);
ieee754sp
ieee754sp_fdp
(
ieee754dp
x
);
union
ieee754sp
ieee754sp_fint
(
int
x
);
union
ieee754sp
ieee754sp_funs
(
unsigned
x
);
union
ieee754sp
ieee754sp_flong
(
s64
x
);
union
ieee754sp
ieee754sp_fulong
(
u64
x
);
union
ieee754sp
ieee754sp_fdp
(
union
ieee754dp
x
);
int
ieee754sp_tint
(
ieee754sp
x
);
unsigned
int
ieee754sp_tuns
(
ieee754sp
x
);
s64
ieee754sp_tlong
(
ieee754sp
x
);
u64
ieee754sp_tulong
(
ieee754sp
x
);
int
ieee754sp_tint
(
union
ieee754sp
x
);
unsigned
int
ieee754sp_tuns
(
union
ieee754sp
x
);
s64
ieee754sp_tlong
(
union
ieee754sp
x
);
u64
ieee754sp_tulong
(
union
ieee754sp
x
);
int
ieee754sp_cmp
(
ieee754sp
x
,
ieee754sp
y
,
int
cop
,
int
sig
);
int
ieee754sp_cmp
(
union
ieee754sp
x
,
union
ieee754sp
y
,
int
cop
,
int
sig
);
/*
* basic sp math
*/
ieee754sp
ieee754sp_modf
(
ieee754sp
x
,
ieee754sp
*
ip
);
ieee754sp
ieee754sp_frexp
(
ieee754sp
x
,
int
*
exp
);
ieee754sp
ieee754sp_ldexp
(
ieee754sp
x
,
int
exp
);
union
ieee754sp
ieee754sp_modf
(
union
ieee754sp
x
,
union
ieee754sp
*
ip
);
union
ieee754sp
ieee754sp_frexp
(
union
ieee754sp
x
,
int
*
exp
);
union
ieee754sp
ieee754sp_ldexp
(
union
ieee754sp
x
,
int
exp
);
ieee754sp
ieee754sp_ceil
(
ieee754sp
x
);
ieee754sp
ieee754sp_floor
(
ieee754sp
x
);
ieee754sp
ieee754sp_trunc
(
ieee754sp
x
);
union
ieee754sp
ieee754sp_ceil
(
union
ieee754sp
x
);
union
ieee754sp
ieee754sp_floor
(
union
ieee754sp
x
);
union
ieee754sp
ieee754sp_trunc
(
union
ieee754sp
x
);
ieee754sp
ieee754sp_sqrt
(
ieee754sp
x
);
union
ieee754sp
ieee754sp_sqrt
(
union
ieee754sp
x
);
/*
* double precision (often aka double)
*/
int
ieee754dp_finite
(
ieee754dp
x
);
int
ieee754dp_class
(
ieee754dp
x
);
int
ieee754dp_finite
(
union
ieee754dp
x
);
int
ieee754dp_class
(
union
ieee754dp
x
);
/* x with sign of y */
ieee754dp
ieee754dp_copysign
(
ieee754dp
x
,
ieee754dp
y
);
union
ieee754dp
ieee754dp_copysign
(
union
ieee754dp
x
,
union
ieee754dp
y
);
ieee754dp
ieee754dp_add
(
ieee754dp
x
,
ieee754dp
y
);
ieee754dp
ieee754dp_sub
(
ieee754dp
x
,
ieee754dp
y
);
ieee754dp
ieee754dp_mul
(
ieee754dp
x
,
ieee754dp
y
);
ieee754dp
ieee754dp_div
(
ieee754dp
x
,
ieee754dp
y
);
union
ieee754dp
ieee754dp_add
(
union
ieee754dp
x
,
union
ieee754dp
y
);
union
ieee754dp
ieee754dp_sub
(
union
ieee754dp
x
,
union
ieee754dp
y
);
union
ieee754dp
ieee754dp_mul
(
union
ieee754dp
x
,
union
ieee754dp
y
);
union
ieee754dp
ieee754dp_div
(
union
ieee754dp
x
,
union
ieee754dp
y
);
ieee754dp
ieee754dp_abs
(
ieee754dp
x
);
ieee754dp
ieee754dp_neg
(
ieee754dp
x
);
ieee754dp
ieee754dp_scalb
(
ieee754dp
x
,
int
);
union
ieee754dp
ieee754dp_abs
(
union
ieee754dp
x
);
union
ieee754dp
ieee754dp_neg
(
union
ieee754dp
x
);
union
ieee754dp
ieee754dp_scalb
(
union
ieee754dp
x
,
int
);
/* return exponent as integer in floating point format
*/
ieee754dp
ieee754dp_logb
(
ieee754dp
x
);
union
ieee754dp
ieee754dp_logb
(
union
ieee754dp
x
);
ieee754dp
ieee754dp_fint
(
int
x
);
ieee754dp
ieee754dp_funs
(
unsigned
x
);
ieee754dp
ieee754dp_flong
(
s64
x
);
ieee754dp
ieee754dp_fulong
(
u64
x
);
ieee754dp
ieee754dp_fsp
(
ieee754sp
x
);
union
ieee754dp
ieee754dp_fint
(
int
x
);
union
ieee754dp
ieee754dp_funs
(
unsigned
x
);
union
ieee754dp
ieee754dp_flong
(
s64
x
);
union
ieee754dp
ieee754dp_fulong
(
u64
x
);
union
ieee754dp
ieee754dp_fsp
(
union
ieee754sp
x
);
ieee754dp
ieee754dp_ceil
(
ieee754dp
x
);
ieee754dp
ieee754dp_floor
(
ieee754dp
x
);
ieee754dp
ieee754dp_trunc
(
ieee754dp
x
);
union
ieee754dp
ieee754dp_ceil
(
union
ieee754dp
x
);
union
ieee754dp
ieee754dp_floor
(
union
ieee754dp
x
);
union
ieee754dp
ieee754dp_trunc
(
union
ieee754dp
x
);
int
ieee754dp_tint
(
ieee754dp
x
);
unsigned
int
ieee754dp_tuns
(
ieee754dp
x
);
s64
ieee754dp_tlong
(
ieee754dp
x
);
u64
ieee754dp_tulong
(
ieee754dp
x
);
int
ieee754dp_tint
(
union
ieee754dp
x
);
unsigned
int
ieee754dp_tuns
(
union
ieee754dp
x
);
s64
ieee754dp_tlong
(
union
ieee754dp
x
);
u64
ieee754dp_tulong
(
union
ieee754dp
x
);
int
ieee754dp_cmp
(
ieee754dp
x
,
ieee754dp
y
,
int
cop
,
int
sig
);
int
ieee754dp_cmp
(
union
ieee754dp
x
,
union
ieee754dp
y
,
int
cop
,
int
sig
);
/*
* basic sp math
*/
ieee754dp
ieee754dp_modf
(
ieee754dp
x
,
ieee754dp
*
ip
);
ieee754dp
ieee754dp_frexp
(
ieee754dp
x
,
int
*
exp
);
ieee754dp
ieee754dp_ldexp
(
ieee754dp
x
,
int
exp
);
union
ieee754dp
ieee754dp_modf
(
union
ieee754dp
x
,
union
ieee754dp
*
ip
);
union
ieee754dp
ieee754dp_frexp
(
union
ieee754dp
x
,
int
*
exp
);
union
ieee754dp
ieee754dp_ldexp
(
union
ieee754dp
x
,
int
exp
);
ieee754dp
ieee754dp_ceil
(
ieee754dp
x
);
ieee754dp
ieee754dp_floor
(
ieee754dp
x
);
ieee754dp
ieee754dp_trunc
(
ieee754dp
x
);
union
ieee754dp
ieee754dp_ceil
(
union
ieee754dp
x
);
union
ieee754dp
ieee754dp_floor
(
union
ieee754dp
x
);
union
ieee754dp
ieee754dp_trunc
(
union
ieee754dp
x
);
ieee754dp
ieee754dp_sqrt
(
ieee754dp
x
);
union
ieee754dp
ieee754dp_sqrt
(
union
ieee754dp
x
);
...
...
@@ -204,65 +204,65 @@ ieee754dp ieee754dp_sqrt(ieee754dp x);
/* "normal" comparisons
*/
static
inline
int
ieee754sp_eq
(
ieee754sp
x
,
ieee754sp
y
)
static
inline
int
ieee754sp_eq
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
return
ieee754sp_cmp
(
x
,
y
,
IEEE754_CEQ
,
0
);
}
static
inline
int
ieee754sp_ne
(
ieee754sp
x
,
ieee754sp
y
)
static
inline
int
ieee754sp_ne
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
return
ieee754sp_cmp
(
x
,
y
,
IEEE754_CLT
|
IEEE754_CGT
|
IEEE754_CUN
,
0
);
}
static
inline
int
ieee754sp_lt
(
ieee754sp
x
,
ieee754sp
y
)
static
inline
int
ieee754sp_lt
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
return
ieee754sp_cmp
(
x
,
y
,
IEEE754_CLT
,
0
);
}
static
inline
int
ieee754sp_le
(
ieee754sp
x
,
ieee754sp
y
)
static
inline
int
ieee754sp_le
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
return
ieee754sp_cmp
(
x
,
y
,
IEEE754_CLT
|
IEEE754_CEQ
,
0
);
}
static
inline
int
ieee754sp_gt
(
ieee754sp
x
,
ieee754sp
y
)
static
inline
int
ieee754sp_gt
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
return
ieee754sp_cmp
(
x
,
y
,
IEEE754_CGT
,
0
);
}
static
inline
int
ieee754sp_ge
(
ieee754sp
x
,
ieee754sp
y
)
static
inline
int
ieee754sp_ge
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
return
ieee754sp_cmp
(
x
,
y
,
IEEE754_CGT
|
IEEE754_CEQ
,
0
);
}
static
inline
int
ieee754dp_eq
(
ieee754dp
x
,
ieee754dp
y
)
static
inline
int
ieee754dp_eq
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
return
ieee754dp_cmp
(
x
,
y
,
IEEE754_CEQ
,
0
);
}
static
inline
int
ieee754dp_ne
(
ieee754dp
x
,
ieee754dp
y
)
static
inline
int
ieee754dp_ne
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
return
ieee754dp_cmp
(
x
,
y
,
IEEE754_CLT
|
IEEE754_CGT
|
IEEE754_CUN
,
0
);
}
static
inline
int
ieee754dp_lt
(
ieee754dp
x
,
ieee754dp
y
)
static
inline
int
ieee754dp_lt
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
return
ieee754dp_cmp
(
x
,
y
,
IEEE754_CLT
,
0
);
}
static
inline
int
ieee754dp_le
(
ieee754dp
x
,
ieee754dp
y
)
static
inline
int
ieee754dp_le
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
return
ieee754dp_cmp
(
x
,
y
,
IEEE754_CLT
|
IEEE754_CEQ
,
0
);
}
static
inline
int
ieee754dp_gt
(
ieee754dp
x
,
ieee754dp
y
)
static
inline
int
ieee754dp_gt
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
return
ieee754dp_cmp
(
x
,
y
,
IEEE754_CGT
,
0
);
}
static
inline
int
ieee754dp_ge
(
ieee754dp
x
,
ieee754dp
y
)
static
inline
int
ieee754dp_ge
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
return
ieee754dp_cmp
(
x
,
y
,
IEEE754_CGT
|
IEEE754_CEQ
,
0
);
}
...
...
@@ -271,8 +271,8 @@ static inline int ieee754dp_ge(ieee754dp x, ieee754dp y)
/*
* Like strtod
*/
ieee754dp
ieee754dp_fstr
(
const
char
*
s
,
char
**
endp
);
char
*
ieee754dp_tstr
(
ieee754dp
x
,
int
prec
,
int
fmt
,
int
af
);
union
ieee754dp
ieee754dp_fstr
(
const
char
*
s
,
char
**
endp
);
char
*
ieee754dp_tstr
(
union
ieee754dp
x
,
int
prec
,
int
fmt
,
int
af
);
/*
...
...
@@ -338,8 +338,8 @@ static inline int ieee754_sxtest(unsigned n)
}
/* debugging */
ieee754sp
ieee754sp_dump
(
char
*
s
,
ieee754sp
x
);
ieee754dp
ieee754dp_dump
(
char
*
s
,
ieee754dp
x
);
union
ieee754sp
ieee754sp_dump
(
char
*
s
,
union
ieee754sp
x
);
union
ieee754dp
ieee754dp_dump
(
char
*
s
,
union
ieee754dp
x
);
#define IEEE754_SPCVAL_PZERO 0
#define IEEE754_SPCVAL_NZERO 1
...
...
@@ -361,8 +361,8 @@ ieee754dp ieee754dp_dump(char *s, ieee754dp x);
extern
const
struct
ieee754dp_const
__ieee754dp_spcvals
[];
extern
const
struct
ieee754sp_const
__ieee754sp_spcvals
[];
#define ieee754dp_spcvals ((const ieee754dp *)__ieee754dp_spcvals)
#define ieee754sp_spcvals ((const ieee754sp *)__ieee754sp_spcvals)
#define ieee754dp_spcvals ((const
union
ieee754dp *)__ieee754dp_spcvals)
#define ieee754sp_spcvals ((const
union
ieee754sp *)__ieee754sp_spcvals)
/*
* Return infinity with given sign
...
...
@@ -404,8 +404,8 @@ struct ieee754xctx {
const
char
*
op
;
/* operation name */
int
rt
;
/* result type */
union
{
ieee754sp
sp
;
/* single precision */
ieee754dp
dp
;
/* double precision */
union
ieee754sp
sp
;
/* single precision */
union
ieee754dp
dp
;
/* double precision */
#ifdef IEEE854_XP
ieee754xp
xp
;
/* extended precision */
#endif
...
...
arch/mips/math-emu/ieee754d.c
浏览文件 @
2209bcb1
...
...
@@ -56,7 +56,7 @@
#define DPBEXP(dp) (dp.parts.bexp)
#define DPMANT(dp) (dp.parts.mant)
ieee754dp
ieee754dp_dump
(
char
*
m
,
ieee754dp
x
)
union
ieee754dp
ieee754dp_dump
(
char
*
m
,
union
ieee754dp
x
)
{
int
i
;
...
...
@@ -96,7 +96,7 @@ ieee754dp ieee754dp_dump(char *m, ieee754dp x)
return
x
;
}
ieee754sp
ieee754sp_dump
(
char
*
m
,
ieee754sp
x
)
union
ieee754sp
ieee754sp_dump
(
char
*
m
,
union
ieee754sp
x
)
{
int
i
;
...
...
arch/mips/math-emu/ieee754dp.c
浏览文件 @
2209bcb1
...
...
@@ -27,26 +27,26 @@
#include "ieee754dp.h"
int
ieee754dp_class
(
ieee754dp
x
)
int
ieee754dp_class
(
union
ieee754dp
x
)
{
COMPXDP
;
EXPLODEXDP
;
return
xc
;
}
int
ieee754dp_isnan
(
ieee754dp
x
)
int
ieee754dp_isnan
(
union
ieee754dp
x
)
{
return
ieee754dp_class
(
x
)
>=
IEEE754_CLASS_SNAN
;
}
int
ieee754dp_issnan
(
ieee754dp
x
)
int
ieee754dp_issnan
(
union
ieee754dp
x
)
{
assert
(
ieee754dp_isnan
(
x
));
return
((
DPMANT
(
x
)
&
DP_MBIT
(
DP_MBITS
-
1
))
==
DP_MBIT
(
DP_MBITS
-
1
));
}
ieee754dp
__cold
ieee754dp_xcpt
(
ieee754dp
r
,
const
char
*
op
,
...)
union
ieee754dp
__cold
ieee754dp_xcpt
(
union
ieee754dp
r
,
const
char
*
op
,
...)
{
struct
ieee754xctx
ax
;
if
(
!
TSTX
())
...
...
@@ -61,7 +61,7 @@ ieee754dp __cold ieee754dp_xcpt(ieee754dp r, const char *op, ...)
return
ax
.
rv
.
dp
;
}
ieee754dp
__cold
ieee754dp_nanxcpt
(
ieee754dp
r
,
const
char
*
op
,
...)
union
ieee754dp
__cold
ieee754dp_nanxcpt
(
union
ieee754dp
r
,
const
char
*
op
,
...)
{
struct
ieee754xctx
ax
;
...
...
@@ -88,7 +88,7 @@ ieee754dp __cold ieee754dp_nanxcpt(ieee754dp r, const char *op, ...)
return
ax
.
rv
.
dp
;
}
ieee754dp
ieee754dp_bestnan
(
ieee754dp
x
,
ieee754dp
y
)
union
ieee754dp
ieee754dp_bestnan
(
union
ieee754dp
x
,
union
ieee754dp
y
)
{
assert
(
ieee754dp_isnan
(
x
));
assert
(
ieee754dp_isnan
(
y
));
...
...
@@ -131,7 +131,7 @@ static u64 get_rounding(int sn, u64 xm)
* xe is an unbiased exponent
* xm is 3bit extended precision value.
*/
ieee754dp
ieee754dp_format
(
int
sn
,
int
xe
,
u64
xm
)
union
ieee754dp
ieee754dp_format
(
int
sn
,
int
xe
,
u64
xm
)
{
assert
(
xm
);
/* we don't gen exact zeros (probably should) */
...
...
arch/mips/math-emu/ieee754dp.h
浏览文件 @
2209bcb1
...
...
@@ -46,9 +46,9 @@
#define DPDNORMX DPDNORMx(xm, xe)
#define DPDNORMY DPDNORMx(ym, ye)
static
inline
ieee754dp
builddp
(
int
s
,
int
bx
,
u64
m
)
static
inline
union
ieee754dp
builddp
(
int
s
,
int
bx
,
u64
m
)
{
ieee754dp
r
;
union
ieee754dp
r
;
assert
((
s
)
==
0
||
(
s
)
==
1
);
assert
((
bx
)
>=
DP_EMIN
-
1
+
DP_EBIAS
...
...
@@ -61,19 +61,19 @@ static inline ieee754dp builddp(int s, int bx, u64 m)
return
r
;
}
extern
int
ieee754dp_isnan
(
ieee754dp
);
extern
int
ieee754dp_issnan
(
ieee754dp
);
extern
int
ieee754dp_isnan
(
union
ieee754dp
);
extern
int
ieee754dp_issnan
(
union
ieee754dp
);
extern
int
__cold
ieee754si_xcpt
(
int
,
const
char
*
,
...);
extern
s64
__cold
ieee754di_xcpt
(
s64
,
const
char
*
,
...);
extern
ieee754dp
__cold
ieee754dp_xcpt
(
ieee754dp
,
const
char
*
,
...);
extern
ieee754dp
__cold
ieee754dp_nanxcpt
(
ieee754dp
,
const
char
*
,
...);
extern
ieee754dp
ieee754dp_bestnan
(
ieee754dp
,
ieee754dp
);
extern
ieee754dp
ieee754dp_format
(
int
,
int
,
u64
);
extern
union
ieee754dp
__cold
ieee754dp_xcpt
(
union
ieee754dp
,
const
char
*
,
...);
extern
union
ieee754dp
__cold
ieee754dp_nanxcpt
(
union
ieee754dp
,
const
char
*
,
...);
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) \
{ \
ieee754dp V = ieee754dp_format(s, e, m); \
union
ieee754dp V = ieee754dp_format(s, e, m); \
if(TSTX()) \
return ieee754dp_xcpt(V, name, a0, a1); \
else \
...
...
arch/mips/math-emu/ieee754m.c
浏览文件 @
2209bcb1
...
...
@@ -26,9 +26,9 @@
#include "ieee754.h"
ieee754dp
ieee754dp_floor
(
ieee754dp
x
)
union
ieee754dp
ieee754dp_floor
(
union
ieee754dp
x
)
{
ieee754dp
i
;
union
ieee754dp
i
;
if
(
ieee754dp_lt
(
ieee754dp_modf
(
x
,
&
i
),
ieee754dp_zero
(
0
)))
return
ieee754dp_sub
(
i
,
ieee754dp_one
(
0
));
...
...
@@ -36,9 +36,9 @@ ieee754dp ieee754dp_floor(ieee754dp x)
return
i
;
}
ieee754dp
ieee754dp_ceil
(
ieee754dp
x
)
union
ieee754dp
ieee754dp_ceil
(
union
ieee754dp
x
)
{
ieee754dp
i
;
union
ieee754dp
i
;
if
(
ieee754dp_gt
(
ieee754dp_modf
(
x
,
&
i
),
ieee754dp_zero
(
0
)))
return
ieee754dp_add
(
i
,
ieee754dp_one
(
0
));
...
...
@@ -46,9 +46,9 @@ ieee754dp ieee754dp_ceil(ieee754dp x)
return
i
;
}
ieee754dp
ieee754dp_trunc
(
ieee754dp
x
)
union
ieee754dp
ieee754dp_trunc
(
union
ieee754dp
x
)
{
ieee754dp
i
;
union
ieee754dp
i
;
(
void
)
ieee754dp_modf
(
x
,
&
i
);
return
i
;
...
...
arch/mips/math-emu/ieee754sp.c
浏览文件 @
2209bcb1
...
...
@@ -27,26 +27,26 @@
#include "ieee754sp.h"
int
ieee754sp_class
(
ieee754sp
x
)
int
ieee754sp_class
(
union
ieee754sp
x
)
{
COMPXSP
;
EXPLODEXSP
;
return
xc
;
}
int
ieee754sp_isnan
(
ieee754sp
x
)
int
ieee754sp_isnan
(
union
ieee754sp
x
)
{
return
ieee754sp_class
(
x
)
>=
IEEE754_CLASS_SNAN
;
}
int
ieee754sp_issnan
(
ieee754sp
x
)
int
ieee754sp_issnan
(
union
ieee754sp
x
)
{
assert
(
ieee754sp_isnan
(
x
));
return
(
SPMANT
(
x
)
&
SP_MBIT
(
SP_MBITS
-
1
));
}
ieee754sp
__cold
ieee754sp_xcpt
(
ieee754sp
r
,
const
char
*
op
,
...)
union
ieee754sp
__cold
ieee754sp_xcpt
(
union
ieee754sp
r
,
const
char
*
op
,
...)
{
struct
ieee754xctx
ax
;
...
...
@@ -62,7 +62,7 @@ ieee754sp __cold ieee754sp_xcpt(ieee754sp r, const char *op, ...)
return
ax
.
rv
.
sp
;
}
ieee754sp
__cold
ieee754sp_nanxcpt
(
ieee754sp
r
,
const
char
*
op
,
...)
union
ieee754sp
__cold
ieee754sp_nanxcpt
(
union
ieee754sp
r
,
const
char
*
op
,
...)
{
struct
ieee754xctx
ax
;
...
...
@@ -89,7 +89,7 @@ ieee754sp __cold ieee754sp_nanxcpt(ieee754sp r, const char *op, ...)
return
ax
.
rv
.
sp
;
}
ieee754sp
ieee754sp_bestnan
(
ieee754sp
x
,
ieee754sp
y
)
union
ieee754sp
ieee754sp_bestnan
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
assert
(
ieee754sp_isnan
(
x
));
assert
(
ieee754sp_isnan
(
y
));
...
...
@@ -132,7 +132,7 @@ static unsigned get_rounding(int sn, unsigned xm)
* xe is an unbiased exponent
* xm is 3bit extended precision value.
*/
ieee754sp
ieee754sp_format
(
int
sn
,
int
xe
,
unsigned
xm
)
union
ieee754sp
ieee754sp_format
(
int
sn
,
int
xe
,
unsigned
xm
)
{
assert
(
xm
);
/* we don't gen exact zeros (probably should) */
...
...
arch/mips/math-emu/ieee754sp.h
浏览文件 @
2209bcb1
...
...
@@ -51,9 +51,9 @@
#define SPDNORMX SPDNORMx(xm, xe)
#define SPDNORMY SPDNORMx(ym, ye)
static
inline
ieee754sp
buildsp
(
int
s
,
int
bx
,
unsigned
m
)
static
inline
union
ieee754sp
buildsp
(
int
s
,
int
bx
,
unsigned
m
)
{
ieee754sp
r
;
union
ieee754sp
r
;
assert
((
s
)
==
0
||
(
s
)
==
1
);
assert
((
bx
)
>=
SP_EMIN
-
1
+
SP_EBIAS
...
...
@@ -67,19 +67,19 @@ static inline ieee754sp buildsp(int s, int bx, unsigned m)
return
r
;
}
extern
int
ieee754sp_isnan
(
ieee754sp
);
extern
int
ieee754sp_issnan
(
ieee754sp
);
extern
int
ieee754sp_isnan
(
union
ieee754sp
);
extern
int
ieee754sp_issnan
(
union
ieee754sp
);
extern
int
__cold
ieee754si_xcpt
(
int
,
const
char
*
,
...);
extern
s64
__cold
ieee754di_xcpt
(
s64
,
const
char
*
,
...);
extern
ieee754sp
__cold
ieee754sp_xcpt
(
ieee754sp
,
const
char
*
,
...);
extern
ieee754sp
__cold
ieee754sp_nanxcpt
(
ieee754sp
,
const
char
*
,
...);
extern
ieee754sp
ieee754sp_bestnan
(
ieee754sp
,
ieee754sp
);
extern
ieee754sp
ieee754sp_format
(
int
,
int
,
unsigned
);
extern
union
ieee754sp
__cold
ieee754sp_xcpt
(
union
ieee754sp
,
const
char
*
,
...);
extern
union
ieee754sp
__cold
ieee754sp_nanxcpt
(
union
ieee754sp
,
const
char
*
,
...);
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) \
{ \
ieee754sp V = ieee754sp_format(s, e, m); \
union
ieee754sp V = ieee754sp_format(s, e, m); \
if(TSTX()) \
return ieee754sp_xcpt(V, name, a0, a1); \
else \
...
...
arch/mips/math-emu/sp_add.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_add
(
ieee754sp
x
,
ieee754sp
y
)
union
ieee754sp
ieee754sp_add
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
COMPXSP
;
COMPYSP
;
...
...
arch/mips/math-emu/sp_cmp.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
int
ieee754sp_cmp
(
ieee754sp
x
,
ieee754sp
y
,
int
cmp
,
int
sig
)
int
ieee754sp_cmp
(
union
ieee754sp
x
,
union
ieee754sp
y
,
int
cmp
,
int
sig
)
{
COMPXSP
;
COMPYSP
;
...
...
arch/mips/math-emu/sp_div.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_div
(
ieee754sp
x
,
ieee754sp
y
)
union
ieee754sp
ieee754sp_div
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
COMPXSP
;
COMPYSP
;
...
...
arch/mips/math-emu/sp_fdp.c
浏览文件 @
2209bcb1
...
...
@@ -26,10 +26,10 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_fdp
(
ieee754dp
x
)
union
ieee754sp
ieee754sp_fdp
(
union
ieee754dp
x
)
{
COMPXDP
;
ieee754sp
nan
;
union
ieee754sp
nan
;
EXPLODEXDP
;
...
...
arch/mips/math-emu/sp_fint.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_fint
(
int
x
)
union
ieee754sp
ieee754sp_fint
(
int
x
)
{
unsigned
xm
;
int
xe
;
...
...
@@ -70,7 +70,7 @@ ieee754sp ieee754sp_fint(int x)
}
ieee754sp
ieee754sp_funs
(
unsigned
int
u
)
union
ieee754sp
ieee754sp_funs
(
unsigned
int
u
)
{
if
((
int
)
u
<
0
)
return
ieee754sp_add
(
ieee754sp_1e31
(),
...
...
arch/mips/math-emu/sp_flong.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_flong
(
s64
x
)
union
ieee754sp
ieee754sp_flong
(
s64
x
)
{
u64
xm
;
/* <--- need 64-bit mantissa temp */
int
xe
;
...
...
@@ -69,7 +69,7 @@ ieee754sp ieee754sp_flong(s64 x)
}
ieee754sp
ieee754sp_fulong
(
u64
u
)
union
ieee754sp
ieee754sp_fulong
(
u64
u
)
{
if
((
s64
)
u
<
0
)
return
ieee754sp_add
(
ieee754sp_1e63
(),
...
...
arch/mips/math-emu/sp_frexp.c
浏览文件 @
2209bcb1
...
...
@@ -28,7 +28,7 @@
/* close to ieeep754sp_logb
*/
ieee754sp
ieee754sp_frexp
(
ieee754sp
x
,
int
*
eptr
)
union
ieee754sp
ieee754sp_frexp
(
union
ieee754sp
x
,
int
*
eptr
)
{
COMPXSP
;
CLEARCX
;
...
...
arch/mips/math-emu/sp_logb.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_logb
(
ieee754sp
x
)
union
ieee754sp
ieee754sp_logb
(
union
ieee754sp
x
)
{
COMPXSP
;
...
...
arch/mips/math-emu/sp_modf.c
浏览文件 @
2209bcb1
...
...
@@ -28,7 +28,7 @@
/* modf function is always exact for a finite number
*/
ieee754sp
ieee754sp_modf
(
ieee754sp
x
,
ieee754sp
*
ip
)
union
ieee754sp
ieee754sp_modf
(
union
ieee754sp
x
,
union
ieee754sp
*
ip
)
{
COMPXSP
;
...
...
arch/mips/math-emu/sp_mul.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_mul
(
ieee754sp
x
,
ieee754sp
y
)
union
ieee754sp
ieee754sp_mul
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
COMPXSP
;
COMPYSP
;
...
...
arch/mips/math-emu/sp_scalb.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_scalb
(
ieee754sp
x
,
int
n
)
union
ieee754sp
ieee754sp_scalb
(
union
ieee754sp
x
,
int
n
)
{
COMPXSP
;
...
...
@@ -51,7 +51,7 @@ ieee754sp ieee754sp_scalb(ieee754sp x, int n)
}
ieee754sp
ieee754sp_ldexp
(
ieee754sp
x
,
int
n
)
union
ieee754sp
ieee754sp_ldexp
(
union
ieee754sp
x
,
int
n
)
{
return
ieee754sp_scalb
(
x
,
n
);
}
arch/mips/math-emu/sp_simple.c
浏览文件 @
2209bcb1
...
...
@@ -26,12 +26,12 @@
#include "ieee754sp.h"
int
ieee754sp_finite
(
ieee754sp
x
)
int
ieee754sp_finite
(
union
ieee754sp
x
)
{
return
SPBEXP
(
x
)
!=
SP_EMAX
+
1
+
SP_EBIAS
;
}
ieee754sp
ieee754sp_copysign
(
ieee754sp
x
,
ieee754sp
y
)
union
ieee754sp
ieee754sp_copysign
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
CLEARCX
;
SPSIGN
(
x
)
=
SPSIGN
(
y
);
...
...
@@ -39,7 +39,7 @@ ieee754sp ieee754sp_copysign(ieee754sp x, ieee754sp y)
}
ieee754sp
ieee754sp_neg
(
ieee754sp
x
)
union
ieee754sp
ieee754sp_neg
(
union
ieee754sp
x
)
{
COMPXSP
;
...
...
@@ -55,7 +55,7 @@ ieee754sp ieee754sp_neg(ieee754sp x)
SPSIGN
(
x
)
^=
1
;
if
(
xc
==
IEEE754_CLASS_SNAN
)
{
ieee754sp
y
=
ieee754sp_indef
();
union
ieee754sp
y
=
ieee754sp_indef
();
SETCX
(
IEEE754_INVALID_OPERATION
);
SPSIGN
(
y
)
=
SPSIGN
(
x
);
return
ieee754sp_nanxcpt
(
y
,
"neg"
);
...
...
@@ -65,7 +65,7 @@ ieee754sp ieee754sp_neg(ieee754sp x)
}
ieee754sp
ieee754sp_abs
(
ieee754sp
x
)
union
ieee754sp
ieee754sp_abs
(
union
ieee754sp
x
)
{
COMPXSP
;
...
...
arch/mips/math-emu/sp_sqrt.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_sqrt
(
ieee754sp
x
)
union
ieee754sp
ieee754sp_sqrt
(
union
ieee754sp
x
)
{
int
ix
,
s
,
q
,
m
,
t
,
i
;
unsigned
int
r
;
...
...
arch/mips/math-emu/sp_sub.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
ieee754sp
ieee754sp_sub
(
ieee754sp
x
,
ieee754sp
y
)
union
ieee754sp
ieee754sp_sub
(
union
ieee754sp
x
,
union
ieee754sp
y
)
{
COMPXSP
;
COMPYSP
;
...
...
arch/mips/math-emu/sp_tint.c
浏览文件 @
2209bcb1
...
...
@@ -27,7 +27,7 @@
#include <linux/kernel.h>
#include "ieee754sp.h"
int
ieee754sp_tint
(
ieee754sp
x
)
int
ieee754sp_tint
(
union
ieee754sp
x
)
{
COMPXSP
;
...
...
@@ -113,9 +113,9 @@ int ieee754sp_tint(ieee754sp x)
}
unsigned
int
ieee754sp_tuns
(
ieee754sp
x
)
unsigned
int
ieee754sp_tuns
(
union
ieee754sp
x
)
{
ieee754sp
hb
=
ieee754sp_1e31
();
union
ieee754sp
hb
=
ieee754sp_1e31
();
/* what if x < 0 ?? */
if
(
ieee754sp_lt
(
x
,
hb
))
...
...
arch/mips/math-emu/sp_tlong.c
浏览文件 @
2209bcb1
...
...
@@ -26,7 +26,7 @@
#include "ieee754sp.h"
s64
ieee754sp_tlong
(
ieee754sp
x
)
s64
ieee754sp_tlong
(
union
ieee754sp
x
)
{
COMPXDP
;
/* <-- need 64-bit mantissa tmp */
...
...
@@ -108,9 +108,9 @@ s64 ieee754sp_tlong(ieee754sp x)
}
u64
ieee754sp_tulong
(
ieee754sp
x
)
u64
ieee754sp_tulong
(
union
ieee754sp
x
)
{
ieee754sp
hb
=
ieee754sp_1e63
();
union
ieee754sp
hb
=
ieee754sp_1e63
();
/* what if x < 0 ?? */
if
(
ieee754sp_lt
(
x
,
hb
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录