Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
4cb26382
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4cb26382
编写于
2月 08, 2010
作者:
A
Aurelien Jarno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tcg/mips: implement setcond
Signed-off-by:
N
Aurelien Jarno
<
aurelien@aurel32.net
>
上级
74f42e18
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
65 addition
and
0 deletion
+65
-0
tcg/mips/tcg-target.c
tcg/mips/tcg-target.c
+65
-0
未找到文件。
tcg/mips/tcg-target.c
浏览文件 @
4cb26382
...
...
@@ -274,6 +274,8 @@ enum {
OPC_BEQ
=
0x04
<<
26
,
OPC_BNE
=
0x05
<<
26
,
OPC_ADDIU
=
0x09
<<
26
,
OPC_SLTI
=
0x0A
<<
26
,
OPC_SLTIU
=
0x0B
<<
26
,
OPC_ANDI
=
0x0C
<<
26
,
OPC_ORI
=
0x0D
<<
26
,
OPC_XORI
=
0x0E
<<
26
,
...
...
@@ -583,6 +585,64 @@ static void tcg_out_brcond2(TCGContext *s, int cond, int arg1,
reloc_pc16
(
label_ptr
,
(
tcg_target_long
)
s
->
code_ptr
);
}
static
void
tcg_out_setcond
(
TCGContext
*
s
,
int
cond
,
int
ret
,
int
arg1
,
int
arg2
)
{
switch
(
cond
)
{
case
TCG_COND_EQ
:
if
(
arg1
==
0
)
{
tcg_out_opc_imm
(
s
,
OPC_SLTIU
,
ret
,
arg2
,
1
);
}
else
if
(
arg2
==
0
)
{
tcg_out_opc_imm
(
s
,
OPC_SLTIU
,
ret
,
arg1
,
1
);
}
else
{
tcg_out_opc_reg
(
s
,
OPC_XOR
,
TCG_REG_AT
,
arg1
,
arg2
);
tcg_out_opc_imm
(
s
,
OPC_SLTIU
,
ret
,
TCG_REG_AT
,
1
);
}
break
;
case
TCG_COND_NE
:
if
(
arg1
==
0
)
{
tcg_out_opc_reg
(
s
,
OPC_SLTU
,
ret
,
TCG_REG_ZERO
,
arg2
);
}
else
if
(
arg2
==
0
)
{
tcg_out_opc_reg
(
s
,
OPC_SLTU
,
ret
,
TCG_REG_ZERO
,
arg1
);
}
else
{
tcg_out_opc_reg
(
s
,
OPC_XOR
,
TCG_REG_AT
,
arg1
,
arg2
);
tcg_out_opc_reg
(
s
,
OPC_SLTU
,
ret
,
TCG_REG_ZERO
,
TCG_REG_AT
);
}
break
;
case
TCG_COND_LT
:
tcg_out_opc_reg
(
s
,
OPC_SLT
,
ret
,
arg1
,
arg2
);
break
;
case
TCG_COND_LTU
:
tcg_out_opc_reg
(
s
,
OPC_SLTU
,
ret
,
arg1
,
arg2
);
break
;
case
TCG_COND_GE
:
tcg_out_opc_reg
(
s
,
OPC_SLT
,
TCG_REG_AT
,
arg1
,
arg2
);
tcg_out_opc_imm
(
s
,
OPC_XORI
,
ret
,
TCG_REG_AT
,
1
);
break
;
case
TCG_COND_GEU
:
tcg_out_opc_reg
(
s
,
OPC_SLTU
,
TCG_REG_AT
,
arg1
,
arg2
);
tcg_out_opc_imm
(
s
,
OPC_XORI
,
ret
,
TCG_REG_AT
,
1
);
break
;
case
TCG_COND_LE
:
tcg_out_opc_reg
(
s
,
OPC_SLT
,
TCG_REG_AT
,
arg2
,
arg1
);
tcg_out_opc_imm
(
s
,
OPC_XORI
,
ret
,
TCG_REG_AT
,
1
);
break
;
case
TCG_COND_LEU
:
tcg_out_opc_reg
(
s
,
OPC_SLTU
,
TCG_REG_AT
,
arg2
,
arg1
);
tcg_out_opc_imm
(
s
,
OPC_XORI
,
ret
,
TCG_REG_AT
,
1
);
break
;
case
TCG_COND_GT
:
tcg_out_opc_reg
(
s
,
OPC_SLT
,
ret
,
arg2
,
arg1
);
break
;
case
TCG_COND_GTU
:
tcg_out_opc_reg
(
s
,
OPC_SLTU
,
ret
,
arg2
,
arg1
);
break
;
default:
tcg_abort
();
break
;
}
}
#if defined(CONFIG_SOFTMMU)
#include "../../softmmu_defs.h"
...
...
@@ -1155,6 +1215,10 @@ static inline void tcg_out_op(TCGContext *s, int opc,
tcg_out_brcond2
(
s
,
args
[
4
],
args
[
0
],
args
[
1
],
args
[
2
],
args
[
3
],
args
[
5
]);
break
;
case
INDEX_op_setcond_i32
:
tcg_out_setcond
(
s
,
args
[
3
],
args
[
0
],
args
[
1
],
args
[
2
]);
break
;
case
INDEX_op_qemu_ld8u
:
tcg_out_qemu_ld
(
s
,
args
,
0
);
break
;
...
...
@@ -1228,6 +1292,7 @@ static const TCGTargetOpDef mips_op_defs[] = {
{
INDEX_op_sar_i32
,
{
"r"
,
"rZ"
,
"riZ"
}
},
{
INDEX_op_brcond_i32
,
{
"rZ"
,
"rZ"
}
},
{
INDEX_op_setcond_i32
,
{
"r"
,
"rZ"
,
"rZ"
}
},
{
INDEX_op_add2_i32
,
{
"r"
,
"r"
,
"rZ"
,
"rZ"
,
"rJZ"
,
"rJZ"
}
},
{
INDEX_op_sub2_i32
,
{
"r"
,
"r"
,
"rZ"
,
"rZ"
,
"rJZ"
,
"rJZ"
}
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录