[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/10] tcg: Optimize muls2_i32
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 09/10] tcg: Optimize muls2_i32 |
Date: |
Fri, 9 Jan 2015 13:23:19 -0800 |
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/optimize.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 067917c..c674fe2 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -1160,15 +1160,22 @@ static void tcg_constant_folding(TCGContext *s)
goto do_default;
case INDEX_op_mulu2_i32:
+ case INDEX_op_muls2_i32:
if (temps[args[2]].state == TCG_TEMP_CONST
&& temps[args[3]].state == TCG_TEMP_CONST) {
uint32_t a = temps[args[2]].val;
uint32_t b = temps[args[3]].val;
- uint64_t r = (uint64_t)a * b;
+ uint64_t r;
TCGArg rl, rh;
TCGOp *op2 = insert_op_before(s, op, INDEX_op_movi_i32, 2);
TCGArg *args2 = &s->gen_opparam_buf[op2->args];
+ if (opc == INDEX_op_mulu2_i32) {
+ r = (uint64_t)a * b;
+ } else {
+ r = (uint64_t)(int32_t)a * (int32_t)b;
+ }
+
rl = args[0];
rh = args[1];
tcg_opt_gen_movi(s, op, args, opc, rl, (uint32_t)r);
--
2.1.0
- [Qemu-devel] [PULL 00/10] Linked list for tcg ops, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 03/10] tcg: Move emit of INDEX_op_end into gen_tb_end, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 02/10] tcg: Reduce ifdefs in tcg-op.c, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 04/10] tcg: Introduce tcg_op_buf_count and tcg_op_buf_full, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 08/10] tcg: Remove unused opcodes, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 07/10] tcg: Implement insert_op_before, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 06/10] tcg: Remove opcodes instead of noping them out, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 10/10] tcg: Further optimizations for add2 and sub2_i32, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 05/10] tcg: Put opcodes in a linked list, Richard Henderson, 2015/01/09
- [Qemu-devel] [PULL 09/10] tcg: Optimize muls2_i32,
Richard Henderson <=
- [Qemu-devel] [PULL 01/10] tcg: Move some opcode generation functions out of line, Richard Henderson, 2015/01/09
- Re: [Qemu-devel] [PULL 00/10] Linked list for tcg ops, Peter Maydell, 2015/01/12