Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
41d72852
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看板
提交
41d72852
编写于
5月 02, 2009
作者:
B
Blue Swirl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize operations with immediate parameters
上级
67526b20
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
200 addition
and
52 deletion
+200
-52
target-sparc/translate.c
target-sparc/translate.c
+200
-52
未找到文件。
target-sparc/translate.c
浏览文件 @
41d72852
...
...
@@ -446,17 +446,43 @@ static inline void gen_tag_tv(TCGv src1, TCGv src2)
gen_set_label
(
l1
);
}
static
inline
void
gen_op_add_cc2
(
TCGv
dst
)
{
gen_cc_clear_icc
();
gen_cc_NZ_icc
(
cpu_cc_dst
);
gen_cc_C_add_icc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_add_icc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#ifdef TARGET_SPARC64
gen_cc_clear_xcc
();
gen_cc_NZ_xcc
(
cpu_cc_dst
);
gen_cc_C_add_xcc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_add_xcc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#endif
tcg_gen_mov_tl
(
dst
,
cpu_cc_dst
);
}
static
inline
void
gen_op_addi_cc
(
TCGv
dst
,
TCGv
src1
,
target_long
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_movi_tl
(
cpu_cc_src2
,
src2
);
tcg_gen_addi_tl
(
cpu_cc_dst
,
cpu_cc_src
,
src2
);
gen_op_add_cc2
(
dst
);
}
static
inline
void
gen_op_add_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_mov_tl
(
cpu_cc_src2
,
src2
);
tcg_gen_add_tl
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
gen_cc_clear_icc
();
gen_op_add_cc2
(
dst
);
}
static
inline
void
gen_op_addx_cc2
(
TCGv
dst
)
{
gen_cc_NZ_icc
(
cpu_cc_dst
);
gen_cc_C_add_icc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_add_icc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#ifdef TARGET_SPARC64
gen_cc_clear_xcc
();
gen_cc_NZ_xcc
(
cpu_cc_dst
);
gen_cc_C_add_xcc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_add_xcc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
...
...
@@ -464,10 +490,10 @@ static inline void gen_op_add_cc(TCGv dst, TCGv src1, TCGv src2)
tcg_gen_mov_tl
(
dst
,
cpu_cc_dst
);
}
static
inline
void
gen_op_addx
_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
static
inline
void
gen_op_addx
i_cc
(
TCGv
dst
,
TCGv
src1
,
target_long
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_mov_tl
(
cpu_cc_src2
,
src2
);
tcg_gen_mov
i
_tl
(
cpu_cc_src2
,
src2
);
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_add_tl
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_tmp0
);
gen_cc_clear_icc
();
...
...
@@ -476,16 +502,24 @@ static inline void gen_op_addx_cc(TCGv dst, TCGv src1, TCGv src2)
gen_cc_clear_xcc
();
gen_cc_C_add_xcc
(
cpu_cc_dst
,
cpu_cc_src
);
#endif
tcg_gen_add_tl
(
cpu_cc_dst
,
cpu_cc_dst
,
cpu_cc_src2
);
gen_cc_NZ_icc
(
cpu_cc_dst
);
tcg_gen_addi_tl
(
cpu_cc_dst
,
cpu_cc_dst
,
src2
);
gen_op_addx_cc2
(
dst
);
}
static
inline
void
gen_op_addx_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_mov_tl
(
cpu_cc_src2
,
src2
);
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_add_tl
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_tmp0
);
gen_cc_clear_icc
();
gen_cc_C_add_icc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_add_icc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#ifdef TARGET_SPARC64
gen_cc_
NZ_xcc
(
cpu_cc_dst
);
gen_cc_
clear_xcc
(
);
gen_cc_C_add_xcc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_add_xcc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#endif
tcg_gen_mov_tl
(
dst
,
cpu_cc_dst
);
tcg_gen_add_tl
(
cpu_cc_dst
,
cpu_cc_dst
,
cpu_cc_src2
);
gen_op_addx_cc2
(
dst
);
}
static
inline
void
gen_op_tadd_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
...
...
@@ -616,11 +650,8 @@ static inline void gen_sub_tv(TCGv dst, TCGv src1, TCGv src2)
tcg_temp_free
(
r_temp
);
}
static
inline
void
gen_op_sub_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
static
inline
void
gen_op_sub_cc
2
(
TCGv
dst
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_mov_tl
(
cpu_cc_src2
,
src2
);
tcg_gen_sub_tl
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
gen_cc_clear_icc
();
gen_cc_NZ_icc
(
cpu_cc_dst
);
gen_cc_C_sub_icc
(
cpu_cc_src
,
cpu_cc_src2
);
...
...
@@ -634,10 +665,39 @@ static inline void gen_op_sub_cc(TCGv dst, TCGv src1, TCGv src2)
tcg_gen_mov_tl
(
dst
,
cpu_cc_dst
);
}
static
inline
void
gen_op_subx_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
static
inline
void
gen_op_subi_cc
(
TCGv
dst
,
TCGv
src1
,
target_long
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_movi_tl
(
cpu_cc_src2
,
src2
);
tcg_gen_subi_tl
(
cpu_cc_dst
,
cpu_cc_src
,
src2
);
gen_op_sub_cc2
(
dst
);
}
static
inline
void
gen_op_sub_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_mov_tl
(
cpu_cc_src2
,
src2
);
tcg_gen_sub_tl
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
gen_op_sub_cc2
(
dst
);
}
static
inline
void
gen_op_subx_cc2
(
TCGv
dst
)
{
gen_cc_NZ_icc
(
cpu_cc_dst
);
gen_cc_C_sub_icc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_sub_icc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#ifdef TARGET_SPARC64
gen_cc_NZ_xcc
(
cpu_cc_dst
);
gen_cc_C_sub_xcc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_sub_xcc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#endif
tcg_gen_mov_tl
(
dst
,
cpu_cc_dst
);
}
static
inline
void
gen_op_subxi_cc
(
TCGv
dst
,
TCGv
src1
,
target_long
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_movi_tl
(
cpu_cc_src2
,
src2
);
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_sub_tl
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_tmp0
);
gen_cc_clear_icc
();
...
...
@@ -646,16 +706,24 @@ static inline void gen_op_subx_cc(TCGv dst, TCGv src1, TCGv src2)
gen_cc_clear_xcc
();
gen_cc_C_sub_xcc
(
cpu_cc_dst
,
cpu_cc_src
);
#endif
tcg_gen_sub_tl
(
cpu_cc_dst
,
cpu_cc_dst
,
cpu_cc_src2
);
gen_cc_NZ_icc
(
cpu_cc_dst
);
tcg_gen_subi_tl
(
cpu_cc_dst
,
cpu_cc_dst
,
src2
);
gen_op_subx_cc2
(
dst
);
}
static
inline
void
gen_op_subx_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
{
tcg_gen_mov_tl
(
cpu_cc_src
,
src1
);
tcg_gen_mov_tl
(
cpu_cc_src2
,
src2
);
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_sub_tl
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_tmp0
);
gen_cc_clear_icc
();
gen_cc_C_sub_icc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_sub_icc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#ifdef TARGET_SPARC64
gen_cc_
NZ_xcc
(
cpu_cc_dst
);
gen_cc_
clear_xcc
(
);
gen_cc_C_sub_xcc
(
cpu_cc_dst
,
cpu_cc_src
);
gen_cc_V_sub_xcc
(
cpu_cc_dst
,
cpu_cc_src
,
cpu_cc_src2
);
#endif
tcg_gen_mov_tl
(
dst
,
cpu_cc_dst
);
tcg_gen_sub_tl
(
cpu_cc_dst
,
cpu_cc_dst
,
cpu_cc_src2
);
gen_op_subx_cc2
(
dst
);
}
static
inline
void
gen_op_tsub_cc
(
TCGv
dst
,
TCGv
src1
,
TCGv
src2
)
...
...
@@ -3064,65 +3132,132 @@ static void disas_sparc_insn(DisasContext * dc)
gen_movl_TN_reg
(
rd
,
cpu_dst
);
#endif
}
else
if
(
xop
<
0x36
)
{
cpu_src1
=
get_src1
(
insn
,
cpu_src1
);
cpu_src2
=
get_src2
(
insn
,
cpu_src2
);
if
(
xop
<
0x20
)
{
cpu_src1
=
get_src1
(
insn
,
cpu_src1
);
cpu_src2
=
get_src2
(
insn
,
cpu_src2
);
switch
(
xop
&
~
0x10
)
{
case
0x0
:
if
(
xop
&
0x10
)
gen_op_add_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
else
tcg_gen_add_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
if
(
xop
&
0x10
)
{
gen_op_addi_cc
(
cpu_dst
,
cpu_src1
,
simm
);
}
else
{
tcg_gen_addi_tl
(
cpu_dst
,
cpu_src1
,
simm
);
}
}
else
{
if
(
xop
&
0x10
)
{
gen_op_add_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
else
{
tcg_gen_add_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
}
break
;
case
0x1
:
tcg_gen_and_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
xop
&
0x10
)
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
tcg_gen_andi_tl
(
cpu_dst
,
cpu_src1
,
simm
);
}
else
{
tcg_gen_and_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
if
(
xop
&
0x10
)
{
gen_op_logic_cc
(
cpu_dst
);
}
break
;
case
0x2
:
tcg_gen_or_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
tcg_gen_ori_tl
(
cpu_dst
,
cpu_src1
,
simm
);
}
else
{
tcg_gen_or_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
if
(
xop
&
0x10
)
gen_op_logic_cc
(
cpu_dst
);
break
;
case
0x3
:
tcg_gen_xor_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
tcg_gen_xori_tl
(
cpu_dst
,
cpu_src1
,
simm
);
}
else
{
tcg_gen_xor_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
if
(
xop
&
0x10
)
gen_op_logic_cc
(
cpu_dst
);
break
;
case
0x4
:
if
(
xop
&
0x10
)
gen_op_sub_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
else
tcg_gen_sub_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
if
(
xop
&
0x10
)
{
gen_op_subi_cc
(
cpu_dst
,
cpu_src1
,
simm
);
}
else
{
tcg_gen_subi_tl
(
cpu_dst
,
cpu_src1
,
simm
);
}
}
else
{
if
(
xop
&
0x10
)
{
gen_op_sub_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
else
{
tcg_gen_sub_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
}
break
;
case
0x5
:
tcg_gen_andc_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
tcg_gen_andi_tl
(
cpu_dst
,
cpu_src1
,
~
simm
);
}
else
{
tcg_gen_andc_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
if
(
xop
&
0x10
)
gen_op_logic_cc
(
cpu_dst
);
break
;
case
0x6
:
tcg_gen_orc_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
tcg_gen_ori_tl
(
cpu_dst
,
cpu_src1
,
~
simm
);
}
else
{
tcg_gen_orc_tl
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
if
(
xop
&
0x10
)
gen_op_logic_cc
(
cpu_dst
);
break
;
case
0x7
:
tcg_gen_not_tl
(
cpu_tmp0
,
cpu_src2
);
tcg_gen_xor_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
tcg_gen_xori_tl
(
cpu_dst
,
cpu_src1
,
~
simm
);
}
else
{
tcg_gen_not_tl
(
cpu_tmp0
,
cpu_src2
);
tcg_gen_xor_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
}
if
(
xop
&
0x10
)
gen_op_logic_cc
(
cpu_dst
);
break
;
case
0x8
:
if
(
xop
&
0x10
)
gen_op_addx_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
else
{
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_add_tl
(
cpu_tmp0
,
cpu_src2
,
cpu_tmp0
);
tcg_gen_add_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
if
(
xop
&
0x10
)
gen_op_addxi_cc
(
cpu_dst
,
cpu_src1
,
simm
);
else
{
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_addi_tl
(
cpu_tmp0
,
cpu_tmp0
,
simm
);
tcg_gen_add_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
}
}
else
{
if
(
xop
&
0x10
)
gen_op_addx_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
else
{
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_add_tl
(
cpu_tmp0
,
cpu_src2
,
cpu_tmp0
);
tcg_gen_add_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
}
}
break
;
#ifdef TARGET_SPARC64
case
0x9
:
/* V9 mulx */
tcg_gen_mul_i64
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
tcg_gen_muli_i64
(
cpu_dst
,
cpu_src1
,
simm
);
}
else
{
tcg_gen_mul_i64
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
break
;
#endif
case
0xa
:
...
...
@@ -3138,12 +3273,23 @@ static void disas_sparc_insn(DisasContext * dc)
gen_op_logic_cc
(
cpu_dst
);
break
;
case
0xc
:
if
(
xop
&
0x10
)
gen_op_subx_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
else
{
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_add_tl
(
cpu_tmp0
,
cpu_src2
,
cpu_tmp0
);
tcg_gen_sub_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
if
(
IS_IMM
)
{
simm
=
GET_FIELDs
(
insn
,
19
,
31
);
if
(
xop
&
0x10
)
{
gen_op_subxi_cc
(
cpu_dst
,
cpu_src1
,
simm
);
}
else
{
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_addi_tl
(
cpu_tmp0
,
cpu_tmp0
,
simm
);
tcg_gen_sub_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
}
}
else
{
if
(
xop
&
0x10
)
{
gen_op_subx_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
}
else
{
gen_mov_reg_C
(
cpu_tmp0
,
cpu_psr
);
tcg_gen_add_tl
(
cpu_tmp0
,
cpu_src2
,
cpu_tmp0
);
tcg_gen_sub_tl
(
cpu_dst
,
cpu_src1
,
cpu_tmp0
);
}
}
break
;
#ifdef TARGET_SPARC64
...
...
@@ -3171,6 +3317,8 @@ static void disas_sparc_insn(DisasContext * dc)
}
gen_movl_TN_reg
(
rd
,
cpu_dst
);
}
else
{
cpu_src1
=
get_src1
(
insn
,
cpu_src1
);
cpu_src2
=
get_src2
(
insn
,
cpu_src2
);
switch
(
xop
)
{
case
0x20
:
/* taddcc */
gen_op_tadd_cc
(
cpu_dst
,
cpu_src1
,
cpu_src2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录