mirror of https://github.com/proxmox/mirror_qemu
Fix andi, optimize addi and subi zero cases
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3985 c046a42c-6fe2-441c-8c8c-71466251a162master
parent
f650305967
commit
7089442cb6
12
tcg/tcg-op.h
12
tcg/tcg-op.h
|
@ -252,8 +252,13 @@ static inline void tcg_gen_add_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||||
|
|
||||||
static inline void tcg_gen_addi_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
static inline void tcg_gen_addi_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||||
{
|
{
|
||||||
|
/* some cases can be optimized here */
|
||||||
|
if (arg2 == 0) {
|
||||||
|
tcg_gen_mov_i32(ret, arg1);
|
||||||
|
} else {
|
||||||
tcg_gen_add_i32(ret, arg1, tcg_const_i32(arg2));
|
tcg_gen_add_i32(ret, arg1, tcg_const_i32(arg2));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void tcg_gen_sub_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
static inline void tcg_gen_sub_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||||
{
|
{
|
||||||
|
@ -262,8 +267,13 @@ static inline void tcg_gen_sub_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||||
|
|
||||||
static inline void tcg_gen_subi_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
static inline void tcg_gen_subi_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||||
{
|
{
|
||||||
|
/* some cases can be optimized here */
|
||||||
|
if (arg2 == 0) {
|
||||||
|
tcg_gen_mov_i32(ret, arg1);
|
||||||
|
} else {
|
||||||
tcg_gen_sub_i32(ret, arg1, tcg_const_i32(arg2));
|
tcg_gen_sub_i32(ret, arg1, tcg_const_i32(arg2));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void tcg_gen_and_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
static inline void tcg_gen_and_i32(TCGv ret, TCGv arg1, TCGv arg2)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +301,7 @@ static inline void tcg_gen_ori_i32(TCGv ret, TCGv arg1, int32_t arg2)
|
||||||
{
|
{
|
||||||
/* some cases can be optimized here */
|
/* some cases can be optimized here */
|
||||||
if (arg2 == 0xffffffff) {
|
if (arg2 == 0xffffffff) {
|
||||||
tcg_gen_movi_i32(ret, 0);
|
tcg_gen_movi_i32(ret, 0xffffffff);
|
||||||
} else if (arg2 == 0) {
|
} else if (arg2 == 0) {
|
||||||
tcg_gen_mov_i32(ret, arg1);
|
tcg_gen_mov_i32(ret, arg1);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue