mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-25 23:48:02 +00:00
tcg/optimize: Fold movcond 0/1 into setcond
Backports commit 333b21b809fc80ce67c8f6a7d1c7cc66437d9791 from qemu
This commit is contained in:
parent
b62743947f
commit
199b3859c4
1 changed files with 15 additions and 0 deletions
|
@ -1116,6 +1116,21 @@ void tcg_optimize(TCGContext *s)
|
||||||
tcg_opt_gen_mov(s, op, args, args[0], args[4-tmp]);
|
tcg_opt_gen_mov(s, op, args, args[0], args[4-tmp]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (temp_is_const(s, args[3]) && temp_is_const(s, args[4])) {
|
||||||
|
tcg_target_ulong tv = temps[args[3]].val;
|
||||||
|
tcg_target_ulong fv = temps[args[4]].val;
|
||||||
|
TCGCond cond = args[5];
|
||||||
|
if (fv == 1 && tv == 0) {
|
||||||
|
cond = tcg_invert_cond(cond);
|
||||||
|
} else if (!(tv == 1 && fv == 0)) {
|
||||||
|
goto do_default;
|
||||||
|
}
|
||||||
|
args[3] = cond;
|
||||||
|
op->opc = opc = (opc == INDEX_op_movcond_i32
|
||||||
|
? INDEX_op_setcond_i32
|
||||||
|
: INDEX_op_setcond_i64);
|
||||||
|
nb_iargs = 2;
|
||||||
|
}
|
||||||
goto do_default;
|
goto do_default;
|
||||||
|
|
||||||
case INDEX_op_add2_i32:
|
case INDEX_op_add2_i32:
|
||||||
|
|
Loading…
Reference in a new issue