[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 12/70] tcg/tci: Merge basic arithmetic operations
From: |
Richard Henderson |
Subject: |
[PATCH v3 12/70] tcg/tci: Merge basic arithmetic operations |
Date: |
Sun, 7 Feb 2021 18:36:54 -0800 |
This includes add, sub, mul, and, or, xor.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/tci.c | 83 +++++++++++++++++--------------------------------------
1 file changed, 25 insertions(+), 58 deletions(-)
diff --git a/tcg/tci.c b/tcg/tci.c
index 0246e663a3..894e87e1b0 100644
--- a/tcg/tci.c
+++ b/tcg/tci.c
@@ -468,26 +468,47 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState
*env,
*(uint32_t *)(t1 + t2) = t0;
break;
- /* Arithmetic operations (32 bit). */
+ /* Arithmetic operations (mixed 32/64 bit). */
- case INDEX_op_add_i32:
+ CASE_32_64(add)
t0 = *tb_ptr++;
t1 = tci_read_r(regs, &tb_ptr);
t2 = tci_read_r(regs, &tb_ptr);
tci_write_reg(regs, t0, t1 + t2);
break;
- case INDEX_op_sub_i32:
+ CASE_32_64(sub)
t0 = *tb_ptr++;
t1 = tci_read_r(regs, &tb_ptr);
t2 = tci_read_r(regs, &tb_ptr);
tci_write_reg(regs, t0, t1 - t2);
break;
- case INDEX_op_mul_i32:
+ CASE_32_64(mul)
t0 = *tb_ptr++;
t1 = tci_read_r(regs, &tb_ptr);
t2 = tci_read_r(regs, &tb_ptr);
tci_write_reg(regs, t0, t1 * t2);
break;
+ CASE_32_64(and)
+ t0 = *tb_ptr++;
+ t1 = tci_read_r(regs, &tb_ptr);
+ t2 = tci_read_r(regs, &tb_ptr);
+ tci_write_reg(regs, t0, t1 & t2);
+ break;
+ CASE_32_64(or)
+ t0 = *tb_ptr++;
+ t1 = tci_read_r(regs, &tb_ptr);
+ t2 = tci_read_r(regs, &tb_ptr);
+ tci_write_reg(regs, t0, t1 | t2);
+ break;
+ CASE_32_64(xor)
+ t0 = *tb_ptr++;
+ t1 = tci_read_r(regs, &tb_ptr);
+ t2 = tci_read_r(regs, &tb_ptr);
+ tci_write_reg(regs, t0, t1 ^ t2);
+ break;
+
+ /* Arithmetic operations (32 bit). */
+
case INDEX_op_div_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(regs, &tb_ptr);
@@ -512,24 +533,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState
*env,
t2 = tci_read_r(regs, &tb_ptr);
tci_write_reg(regs, t0, (uint32_t)t1 % (uint32_t)t2);
break;
- case INDEX_op_and_i32:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 & t2);
- break;
- case INDEX_op_or_i32:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 | t2);
- break;
- case INDEX_op_xor_i32:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 ^ t2);
- break;
/* Shift/rotate operations (32 bit). */
@@ -712,24 +715,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState
*env,
/* Arithmetic operations (64 bit). */
- case INDEX_op_add_i64:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 + t2);
- break;
- case INDEX_op_sub_i64:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 - t2);
- break;
- case INDEX_op_mul_i64:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 * t2);
- break;
case INDEX_op_div_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(regs, &tb_ptr);
@@ -754,24 +739,6 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState
*env,
t2 = tci_read_r(regs, &tb_ptr);
tci_write_reg(regs, t0, (uint64_t)t1 % (uint64_t)t2);
break;
- case INDEX_op_and_i64:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 & t2);
- break;
- case INDEX_op_or_i64:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 | t2);
- break;
- case INDEX_op_xor_i64:
- t0 = *tb_ptr++;
- t1 = tci_read_r(regs, &tb_ptr);
- t2 = tci_read_r(regs, &tb_ptr);
- tci_write_reg(regs, t0, t1 ^ t2);
- break;
/* Shift/rotate operations (64 bit). */
--
2.25.1
- [PATCH v3 03/70] tcg: Manage splitwx in tc_ptr_to_region_tree by hand, (continued)
- [PATCH v3 03/70] tcg: Manage splitwx in tc_ptr_to_region_tree by hand, Richard Henderson, 2021/02/07
- [PATCH v3 05/70] tcg/tci: Remove tci_read_r8, Richard Henderson, 2021/02/07
- [PATCH v3 06/70] tcg/tci: Remove tci_read_r8s, Richard Henderson, 2021/02/07
- [PATCH v3 07/70] tcg/tci: Remove tci_read_r16, Richard Henderson, 2021/02/07
- [PATCH v3 08/70] tcg/tci: Remove tci_read_r16s, Richard Henderson, 2021/02/07
- [PATCH v3 09/70] tcg/tci: Remove tci_read_r32, Richard Henderson, 2021/02/07
- [PATCH v3 13/70] tcg/tci: Merge extension operations, Richard Henderson, 2021/02/07
- [PATCH v3 14/70] tcg/tci: Remove ifdefs for TCG_TARGET_HAS_ext32[us]_i64, Richard Henderson, 2021/02/07
- [PATCH v3 10/70] tcg/tci: Remove tci_read_r32s, Richard Henderson, 2021/02/07
- [PATCH v3 11/70] tcg/tci: Reduce use of tci_read_r64, Richard Henderson, 2021/02/07
- [PATCH v3 12/70] tcg/tci: Merge basic arithmetic operations,
Richard Henderson <=
- [PATCH v3 16/70] tcg/tci: Merge mov, not and neg operations, Richard Henderson, 2021/02/07
- [PATCH v3 18/70] tcg/tci: Split out tci_args_rrs, Richard Henderson, 2021/02/07
- [PATCH v3 15/70] tcg/tci: Merge bswap operations, Richard Henderson, 2021/02/07
- [PATCH v3 19/70] tcg/tci: Split out tci_args_rr, Richard Henderson, 2021/02/07
- [PATCH v3 20/70] tcg/tci: Split out tci_args_rrr, Richard Henderson, 2021/02/07
- [PATCH v3 21/70] tcg/tci: Split out tci_args_rrrc, Richard Henderson, 2021/02/07
- [PATCH v3 17/70] tcg/tci: Rename tci_read_r to tci_read_rval, Richard Henderson, 2021/02/07
- [PATCH v3 22/70] tcg/tci: Split out tci_args_l, Richard Henderson, 2021/02/07
- [PATCH v3 24/70] tcg/tci: Split out tci_args_rrcl and tci_args_rrrrcl, Richard Henderson, 2021/02/07
- [PATCH v3 26/70] tcg/tci: Reuse tci_args_l for calls., Richard Henderson, 2021/02/07