[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 14/14] tcg/optimize: Fold movcond 0/1 into setcond
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [RFC 14/14] tcg/optimize: Fold movcond 0/1 into setcond |
Date: |
Wed, 16 Nov 2016 20:51:50 +0100 |
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/optimize.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 06a8c13..28ce624 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1143,6 +1143,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 = temp_info(args[3])->val;
+ tcg_target_ulong fv = temp_info(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:
--
2.7.4
- [Qemu-devel] [RFC 05/14] tcg: Avoid loops against variable bounds, (continued)
- [Qemu-devel] [RFC 05/14] tcg: Avoid loops against variable bounds, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 03/14] tcg: Use per-temp state data in liveness, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 06/14] tcg: More use of arg_temp, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 07/14] tcg: Change temp_allocate_frame arg to TCGTemp, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 08/14] tcg: Remove unused TCG_CALL_DUMMY_TCGV, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 09/14] tcg: More use of arg_index, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 10/14] tcg: Map TCG_CALL_DUMMY_ARG to NULL, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 13/14] tcg: Use temp number 0 again, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 11/14] tcg: Introduce temp_info for the optimize pass, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 12/14] tcg: Store pointers to temporaries directly in TCGArg, Richard Henderson, 2016/11/16
- [Qemu-devel] [RFC 14/14] tcg/optimize: Fold movcond 0/1 into setcond,
Richard Henderson <=