diff options
author | Richard Henderson | 2016-10-24 05:44:32 +0200 |
---|---|---|
committer | Richard Henderson | 2017-01-10 17:06:10 +0100 |
commit | 333b21b809fc80ce67c8f6a7d1c7cc66437d9791 (patch) | |
tree | 73ea27d899c3480ef32a2053f79b496c86b37c17 | |
parent | target-s390x: Use the new deposit and extract ops (diff) | |
download | qemu-333b21b809fc80ce67c8f6a7d1c7cc66437d9791.tar.gz qemu-333b21b809fc80ce67c8f6a7d1c7cc66437d9791.tar.xz qemu-333b21b809fc80ce67c8f6a7d1c7cc66437d9791.zip |
tcg/optimize: Fold movcond 0/1 into setcond
Signed-off-by: Richard Henderson <rth@twiddle.net>
-rw-r--r-- | tcg/optimize.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index f41ed2cfc1..9e26bb7e4e 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1105,6 +1105,21 @@ void tcg_optimize(TCGContext *s) tcg_opt_gen_mov(s, op, args, args[0], args[4-tmp]); break; } + if (temp_is_const(args[3]) && temp_is_const(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; case INDEX_op_add2_i32: |