mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
tcg: Merge INDEX_op_mul_{i32,i64}
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
@@ -273,7 +273,7 @@ Arithmetic
|
||||
|
||||
- | *t0* = -*t1* (two's complement)
|
||||
|
||||
* - mul_i32/i64 *t0*, *t1*, *t2*
|
||||
* - mul *t0*, *t1*, *t2*
|
||||
|
||||
- | *t0* = *t1* * *t2*
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ DEF(add, 1, 2, 0, TCG_OPF_INT)
|
||||
DEF(and, 1, 2, 0, TCG_OPF_INT)
|
||||
DEF(andc, 1, 2, 0, TCG_OPF_INT)
|
||||
DEF(eqv, 1, 2, 0, TCG_OPF_INT)
|
||||
DEF(mul, 1, 2, 0, TCG_OPF_INT)
|
||||
DEF(nand, 1, 2, 0, TCG_OPF_INT)
|
||||
DEF(neg, 1, 1, 0, TCG_OPF_INT)
|
||||
DEF(nor, 1, 2, 0, TCG_OPF_INT)
|
||||
@@ -65,7 +66,6 @@ DEF(st8_i32, 0, 2, 1, 0)
|
||||
DEF(st16_i32, 0, 2, 1, 0)
|
||||
DEF(st_i32, 0, 2, 1, 0)
|
||||
/* arith */
|
||||
DEF(mul_i32, 1, 2, 0, 0)
|
||||
DEF(div_i32, 1, 2, 0, 0)
|
||||
DEF(divu_i32, 1, 2, 0, 0)
|
||||
DEF(rem_i32, 1, 2, 0, 0)
|
||||
@@ -116,7 +116,6 @@ DEF(st16_i64, 0, 2, 1, 0)
|
||||
DEF(st32_i64, 0, 2, 1, 0)
|
||||
DEF(st_i64, 0, 2, 1, 0)
|
||||
/* arith */
|
||||
DEF(mul_i64, 1, 2, 0, 0)
|
||||
DEF(div_i64, 1, 2, 0, 0)
|
||||
DEF(divu_i64, 1, 2, 0, 0)
|
||||
DEF(rem_i64, 1, 2, 0, 0)
|
||||
|
||||
+2
-2
@@ -430,7 +430,7 @@ static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y)
|
||||
case INDEX_op_sub:
|
||||
return x - y;
|
||||
|
||||
CASE_OP_32_64(mul):
|
||||
case INDEX_op_mul:
|
||||
return x * y;
|
||||
|
||||
case INDEX_op_and:
|
||||
@@ -2963,7 +2963,7 @@ void tcg_optimize(TCGContext *s)
|
||||
CASE_OP_32_64(movcond):
|
||||
done = fold_movcond(&ctx, op);
|
||||
break;
|
||||
CASE_OP_32_64(mul):
|
||||
case INDEX_op_mul:
|
||||
done = fold_mul(&ctx, op);
|
||||
break;
|
||||
CASE_OP_32_64(mulsh):
|
||||
|
||||
+6
-6
@@ -585,7 +585,7 @@ void tcg_gen_negsetcondi_i32(TCGCond cond, TCGv_i32 ret,
|
||||
|
||||
void tcg_gen_mul_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
|
||||
{
|
||||
tcg_gen_op3_i32(INDEX_op_mul_i32, ret, arg1, arg2);
|
||||
tcg_gen_op3_i32(INDEX_op_mul, ret, arg1, arg2);
|
||||
}
|
||||
|
||||
void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
|
||||
@@ -1134,7 +1134,7 @@ void tcg_gen_mulu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2)
|
||||
tcg_gen_op4_i32(INDEX_op_mulu2_i32, rl, rh, arg1, arg2);
|
||||
} else if (TCG_TARGET_HAS_muluh_i32) {
|
||||
TCGv_i32 t = tcg_temp_ebb_new_i32();
|
||||
tcg_gen_op3_i32(INDEX_op_mul_i32, t, arg1, arg2);
|
||||
tcg_gen_op3_i32(INDEX_op_mul, t, arg1, arg2);
|
||||
tcg_gen_op3_i32(INDEX_op_muluh_i32, rh, arg1, arg2);
|
||||
tcg_gen_mov_i32(rl, t);
|
||||
tcg_temp_free_i32(t);
|
||||
@@ -1158,7 +1158,7 @@ void tcg_gen_muls2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 arg2)
|
||||
tcg_gen_op4_i32(INDEX_op_muls2_i32, rl, rh, arg1, arg2);
|
||||
} else if (TCG_TARGET_HAS_mulsh_i32) {
|
||||
TCGv_i32 t = tcg_temp_ebb_new_i32();
|
||||
tcg_gen_op3_i32(INDEX_op_mul_i32, t, arg1, arg2);
|
||||
tcg_gen_op3_i32(INDEX_op_mul, t, arg1, arg2);
|
||||
tcg_gen_op3_i32(INDEX_op_mulsh_i32, rh, arg1, arg2);
|
||||
tcg_gen_mov_i32(rl, t);
|
||||
tcg_temp_free_i32(t);
|
||||
@@ -1636,7 +1636,7 @@ void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
|
||||
TCGv_i32 t1;
|
||||
|
||||
if (TCG_TARGET_REG_BITS == 64) {
|
||||
tcg_gen_op3_i64(INDEX_op_mul_i64, ret, arg1, arg2);
|
||||
tcg_gen_op3_i64(INDEX_op_mul, ret, arg1, arg2);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2844,7 +2844,7 @@ void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2)
|
||||
tcg_gen_op4_i64(INDEX_op_mulu2_i64, rl, rh, arg1, arg2);
|
||||
} else if (TCG_TARGET_HAS_muluh_i64) {
|
||||
TCGv_i64 t = tcg_temp_ebb_new_i64();
|
||||
tcg_gen_op3_i64(INDEX_op_mul_i64, t, arg1, arg2);
|
||||
tcg_gen_op3_i64(INDEX_op_mul, t, arg1, arg2);
|
||||
tcg_gen_op3_i64(INDEX_op_muluh_i64, rh, arg1, arg2);
|
||||
tcg_gen_mov_i64(rl, t);
|
||||
tcg_temp_free_i64(t);
|
||||
@@ -2863,7 +2863,7 @@ void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2)
|
||||
tcg_gen_op4_i64(INDEX_op_muls2_i64, rl, rh, arg1, arg2);
|
||||
} else if (TCG_TARGET_HAS_mulsh_i64) {
|
||||
TCGv_i64 t = tcg_temp_ebb_new_i64();
|
||||
tcg_gen_op3_i64(INDEX_op_mul_i64, t, arg1, arg2);
|
||||
tcg_gen_op3_i64(INDEX_op_mul, t, arg1, arg2);
|
||||
tcg_gen_op3_i64(INDEX_op_mulsh_i64, rh, arg1, arg2);
|
||||
tcg_gen_mov_i64(rl, t);
|
||||
tcg_temp_free_i64(t);
|
||||
|
||||
@@ -1021,8 +1021,7 @@ static const TCGOutOp * const all_outop[NB_OPS] = {
|
||||
OUTOP(INDEX_op_and, TCGOutOpBinary, outop_and),
|
||||
OUTOP(INDEX_op_andc, TCGOutOpBinary, outop_andc),
|
||||
OUTOP(INDEX_op_eqv, TCGOutOpBinary, outop_eqv),
|
||||
OUTOP(INDEX_op_mul_i32, TCGOutOpBinary, outop_mul),
|
||||
OUTOP(INDEX_op_mul_i64, TCGOutOpBinary, outop_mul),
|
||||
OUTOP(INDEX_op_mul, TCGOutOpBinary, outop_mul),
|
||||
OUTOP(INDEX_op_nand, TCGOutOpBinary, outop_nand),
|
||||
OUTOP(INDEX_op_neg, TCGOutOpUnary, outop_neg),
|
||||
OUTOP(INDEX_op_nor, TCGOutOpBinary, outop_nor),
|
||||
@@ -4035,22 +4034,22 @@ liveness_pass_1(TCGContext *s)
|
||||
goto do_not_remove;
|
||||
|
||||
case INDEX_op_mulu2_i32:
|
||||
opc_new = INDEX_op_mul_i32;
|
||||
opc_new = INDEX_op_mul;
|
||||
opc_new2 = INDEX_op_muluh_i32;
|
||||
have_opc_new2 = TCG_TARGET_HAS_muluh_i32;
|
||||
goto do_mul2;
|
||||
case INDEX_op_muls2_i32:
|
||||
opc_new = INDEX_op_mul_i32;
|
||||
opc_new = INDEX_op_mul;
|
||||
opc_new2 = INDEX_op_mulsh_i32;
|
||||
have_opc_new2 = TCG_TARGET_HAS_mulsh_i32;
|
||||
goto do_mul2;
|
||||
case INDEX_op_mulu2_i64:
|
||||
opc_new = INDEX_op_mul_i64;
|
||||
opc_new = INDEX_op_mul;
|
||||
opc_new2 = INDEX_op_muluh_i64;
|
||||
have_opc_new2 = TCG_TARGET_HAS_muluh_i64;
|
||||
goto do_mul2;
|
||||
case INDEX_op_muls2_i64:
|
||||
opc_new = INDEX_op_mul_i64;
|
||||
opc_new = INDEX_op_mul;
|
||||
opc_new2 = INDEX_op_mulsh_i64;
|
||||
have_opc_new2 = TCG_TARGET_HAS_mulsh_i64;
|
||||
goto do_mul2;
|
||||
@@ -5436,8 +5435,7 @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op)
|
||||
case INDEX_op_and:
|
||||
case INDEX_op_andc:
|
||||
case INDEX_op_eqv:
|
||||
case INDEX_op_mul_i32:
|
||||
case INDEX_op_mul_i64:
|
||||
case INDEX_op_mul:
|
||||
case INDEX_op_nand:
|
||||
case INDEX_op_nor:
|
||||
case INDEX_op_or:
|
||||
|
||||
@@ -531,7 +531,7 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
|
||||
tci_args_rrr(insn, &r0, &r1, &r2);
|
||||
regs[r0] = regs[r1] - regs[r2];
|
||||
break;
|
||||
CASE_32_64(mul)
|
||||
case INDEX_op_mul:
|
||||
tci_args_rrr(insn, &r0, &r1, &r2);
|
||||
regs[r0] = regs[r1] * regs[r2];
|
||||
break;
|
||||
@@ -1072,14 +1072,13 @@ int print_insn_tci(bfd_vma addr, disassemble_info *info)
|
||||
case INDEX_op_and:
|
||||
case INDEX_op_andc:
|
||||
case INDEX_op_eqv:
|
||||
case INDEX_op_mul:
|
||||
case INDEX_op_nand:
|
||||
case INDEX_op_nor:
|
||||
case INDEX_op_or:
|
||||
case INDEX_op_orc:
|
||||
case INDEX_op_sub:
|
||||
case INDEX_op_xor:
|
||||
case INDEX_op_mul_i32:
|
||||
case INDEX_op_mul_i64:
|
||||
case INDEX_op_div_i32:
|
||||
case INDEX_op_div_i64:
|
||||
case INDEX_op_rem_i32:
|
||||
|
||||
@@ -662,7 +662,7 @@ static const TCGOutOpBinary outop_eqv = {
|
||||
static void tgen_mul(TCGContext *s, TCGType type,
|
||||
TCGReg a0, TCGReg a1, TCGReg a2)
|
||||
{
|
||||
tcg_out_op_rrr(s, glue(INDEX_op_mul_i,TCG_TARGET_REG_BITS), a0, a1, a2);
|
||||
tcg_out_op_rrr(s, INDEX_op_mul, a0, a1, a2);
|
||||
}
|
||||
|
||||
static const TCGOutOpBinary outop_mul = {
|
||||
|
||||
Reference in New Issue
Block a user