Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
86bd2ca5
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
86bd2ca5
编写于
3月 20, 2005
作者:
B
bellard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NaN tests
git-svn-id:
svn://svn.savannah.nongnu.org/qemu/trunk@1342
c046a42c-6fe2-441c-8c8c-71466251a162
上级
8422b113
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
124 addition
and
58 deletion
+124
-58
tests/test-i386.c
tests/test-i386.c
+124
-58
未找到文件。
tests/test-i386.c
浏览文件 @
86bd2ca5
...
...
@@ -40,6 +40,7 @@
#define TEST_CMOV 1
#define TEST_FCOMI 1
#else
//#define TEST_SSE
#define TEST_CMOV 0
#define TEST_FCOMI 0
#endif
...
...
@@ -697,6 +698,14 @@ void test_bsx(void)
/**********************************************/
union
float64u
{
double
d
;
uint64_t
l
;
};
union
float64u
q_nan
=
{
.
l
=
0xFFF8000000000000
};
union
float64u
s_nan
=
{
.
l
=
0xFFF0000000000000
};
void
test_fops
(
double
a
,
double
b
)
{
printf
(
"a=%f b=%f a+b=%f
\n
"
,
a
,
b
,
a
+
b
);
...
...
@@ -718,28 +727,68 @@ void test_fops(double a, double b)
}
void
fpu_clear_exceptions
(
void
)
{
struct
__attribute__
((
packed
))
{
uint16_t
fpuc
;
uint16_t
dummy1
;
uint16_t
fpus
;
uint16_t
dummy2
;
uint16_t
fptag
;
uint16_t
dummy3
;
uint32_t
ignored
[
4
];
long
double
fpregs
[
8
];
}
float_env32
;
asm
volatile
(
"fnstenv %0
\n
"
:
:
"m"
(
float_env32
));
float_env32
.
fpus
&=
~
0x7f
;
asm
volatile
(
"fldenv %0
\n
"
:
:
"m"
(
float_env32
));
}
/* XXX: display exception bits when supported */
#define FPUS_EMASK 0x0000
//#define FPUS_EMASK 0x007f
void
test_fcmp
(
double
a
,
double
b
)
{
printf
(
"(%f<%f)=%d
\n
"
,
a
,
b
,
a
<
b
);
printf
(
"(%f<=%f)=%d
\n
"
,
a
,
b
,
a
<=
b
);
printf
(
"(%f==%f)=%d
\n
"
,
a
,
b
,
a
==
b
);
printf
(
"(%f>%f)=%d
\n
"
,
a
,
b
,
a
>
b
);
printf
(
"(%f<=%f)=%d
\n
"
,
a
,
b
,
a
>=
b
);
long
eflags
,
fpus
;
fpu_clear_exceptions
();
asm
(
"fcom %2
\n
"
"fstsw %%ax
\n
"
:
"=a"
(
fpus
)
:
"t"
(
a
),
"u"
(
b
));
printf
(
"fcom(%f %f)=%04lx
\n
"
,
a
,
b
,
fpus
&
(
0x4500
|
FPUS_EMASK
));
fpu_clear_exceptions
();
asm
(
"fucom %2
\n
"
"fstsw %%ax
\n
"
:
"=a"
(
fpus
)
:
"t"
(
a
),
"u"
(
b
));
printf
(
"fucom(%f %f)=%04lx
\n
"
,
a
,
b
,
fpus
&
(
0x4500
|
FPUS_EMASK
));
if
(
TEST_FCOMI
)
{
long
eflags
;
/* test f(u)comi instruction */
asm
(
"fcomi %2, %1
\n
"
fpu_clear_exceptions
();
asm
(
"fcomi %3, %2
\n
"
"fstsw %%ax
\n
"
"pushf
\n
"
"pop %0
\n
"
:
"=r"
(
eflags
)
:
"=r"
(
eflags
)
,
"=a"
(
fpus
)
:
"t"
(
a
),
"u"
(
b
));
printf
(
"fcomi(%f %f)=%08lx
\n
"
,
a
,
b
,
eflags
&
(
CC_Z
|
CC_P
|
CC_C
));
printf
(
"fcomi(%f %f)=%04lx %02lx
\n
"
,
a
,
b
,
fpus
&
FPUS_EMASK
,
eflags
&
(
CC_Z
|
CC_P
|
CC_C
));
fpu_clear_exceptions
();
asm
(
"fucomi %3, %2
\n
"
"fstsw %%ax
\n
"
"pushf
\n
"
"pop %0
\n
"
:
"=r"
(
eflags
),
"=a"
(
fpus
)
:
"t"
(
a
),
"u"
(
b
));
printf
(
"fucomi(%f %f)=%04lx %02lx
\n
"
,
a
,
b
,
fpus
&
FPUS_EMASK
,
eflags
&
(
CC_Z
|
CC_P
|
CC_C
));
}
fpu_clear_exceptions
();
}
void
test_fcvt
(
double
a
)
...
...
@@ -907,6 +956,8 @@ void test_floats(void)
test_fcmp
(
2
,
-
1
);
test_fcmp
(
2
,
2
);
test_fcmp
(
2
,
3
);
test_fcmp
(
2
,
q_nan
.
d
);
test_fcmp
(
q_nan
.
d
,
-
1
);
test_fcvt
(
0
.
5
);
test_fcvt
(
-
0
.
5
);
test_fcvt
(
1
.
0
/
7
.
0
);
...
...
@@ -2191,6 +2242,7 @@ void test_fxsave(void)
void
test_sse
(
void
)
{
XMMReg
r
,
a
,
b
;
int
i
;
MMX_OP2
(
punpcklbw
);
MMX_OP2
(
punpcklwd
);
...
...
@@ -2354,51 +2406,65 @@ void test_sse(void)
test_sse_comi
(
2
,
-
1
);
test_sse_comi
(
2
,
2
);
test_sse_comi
(
2
,
3
);
test_sse_comi
(
2
,
q_nan
.
d
);
test_sse_comi
(
q_nan
.
d
,
-
1
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
a
.
s
[
0
]
=
2
.
7
;
a
.
s
[
1
]
=
3
.
4
;
a
.
s
[
2
]
=
4
;
a
.
s
[
3
]
=
-
6
.
3
;
b
.
s
[
0
]
=
45
.
7
;
b
.
s
[
1
]
=
353
.
4
;
b
.
s
[
2
]
=
4
;
b
.
s
[
3
]
=
56
.
3
;
if
(
i
==
1
)
{
a
.
s
[
0
]
=
q_nan
.
d
;
b
.
s
[
3
]
=
q_nan
.
d
;
}
SSE_OPS
(
add
);
SSE_OPS
(
mul
);
SSE_OPS
(
sub
);
SSE_OPS
(
min
);
SSE_OPS
(
div
);
SSE_OPS
(
max
);
SSE_OPS
(
sqrt
);
SSE_OPS
(
cmpeq
);
SSE_OPS
(
cmplt
);
SSE_OPS
(
cmple
);
SSE_OPS
(
cmpunord
);
SSE_OPS
(
cmpneq
);
SSE_OPS
(
cmpnlt
);
SSE_OPS
(
cmpnle
);
SSE_OPS
(
cmpord
);
a
.
d
[
0
]
=
2
.
7
;
a
.
d
[
1
]
=
-
3
.
4
;
b
.
d
[
0
]
=
45
.
7
;
b
.
d
[
1
]
=
-
53
.
4
;
if
(
i
==
1
)
{
a
.
d
[
0
]
=
q_nan
.
d
;
b
.
d
[
1
]
=
q_nan
.
d
;
}
SSE_OPD
(
add
);
SSE_OPD
(
mul
);
SSE_OPD
(
sub
);
SSE_OPD
(
min
);
SSE_OPD
(
div
);
SSE_OPD
(
max
);
SSE_OPD
(
sqrt
);
SSE_OPD
(
cmpeq
);
SSE_OPD
(
cmplt
);
SSE_OPD
(
cmple
);
SSE_OPD
(
cmpunord
);
SSE_OPD
(
cmpneq
);
SSE_OPD
(
cmpnlt
);
SSE_OPD
(
cmpnle
);
SSE_OPD
(
cmpord
);
}
a
.
s
[
0
]
=
2
.
7
;
a
.
s
[
1
]
=
3
.
4
;
a
.
s
[
2
]
=
4
;
a
.
s
[
3
]
=
-
6
.
3
;
b
.
s
[
0
]
=
45
.
7
;
b
.
s
[
1
]
=
353
.
4
;
b
.
s
[
2
]
=
4
;
b
.
s
[
3
]
=
56
.
3
;
SSE_OPS
(
add
);
SSE_OPS
(
mul
);
SSE_OPS
(
sub
);
SSE_OPS
(
min
);
SSE_OPS
(
div
);
SSE_OPS
(
max
);
SSE_OPS
(
sqrt
);
SSE_OPS
(
cmpeq
);
SSE_OPS
(
cmplt
);
SSE_OPS
(
cmple
);
SSE_OPS
(
cmpunord
);
SSE_OPS
(
cmpneq
);
SSE_OPS
(
cmpnlt
);
SSE_OPS
(
cmpnle
);
SSE_OPS
(
cmpord
);
a
.
d
[
0
]
=
2
.
7
;
a
.
d
[
1
]
=
-
3
.
4
;
b
.
d
[
0
]
=
45
.
7
;
b
.
d
[
1
]
=
-
53
.
4
;
SSE_OPD
(
add
);
SSE_OPD
(
mul
);
SSE_OPD
(
sub
);
SSE_OPD
(
min
);
SSE_OPD
(
div
);
SSE_OPD
(
max
);
SSE_OPD
(
sqrt
);
SSE_OPD
(
cmpeq
);
SSE_OPD
(
cmplt
);
SSE_OPD
(
cmple
);
SSE_OPD
(
cmpunord
);
SSE_OPD
(
cmpneq
);
SSE_OPD
(
cmpnlt
);
SSE_OPD
(
cmpnle
);
SSE_OPD
(
cmpord
);
/* float to float/int */
a
.
s
[
0
]
=
2
.
7
;
a
.
s
[
1
]
=
3
.
4
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录