[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 15/69] target/arm: Convert disas_adc_sbc to decodetree
From: |
Richard Henderson |
Subject: |
[PATCH v3 15/69] target/arm: Convert disas_adc_sbc to decodetree |
Date: |
Wed, 11 Dec 2024 10:29:42 -0600 |
This includes ADC, SBC, ADCS, SBCS.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/translate-a64.c | 43 +++++++++++++---------------------
target/arm/tcg/a64.decode | 6 +++++
2 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 99ff787c61..d7747fcf57 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -8017,42 +8017,34 @@ TRANS(SMSUBL, do_muladd, a, true, true, MO_SL)
TRANS(UMADDL, do_muladd, a, true, false, MO_UL)
TRANS(UMSUBL, do_muladd, a, true, true, MO_UL)
-/* Add/subtract (with carry)
- * 31 30 29 28 27 26 25 24 23 22 21 20 16 15 10 9 5 4 0
- * +--+--+--+------------------------+------+-------------+------+-----+
- * |sf|op| S| 1 1 0 1 0 0 0 0 | rm | 0 0 0 0 0 0 | Rn | Rd |
- * +--+--+--+------------------------+------+-------------+------+-----+
- */
-
-static void disas_adc_sbc(DisasContext *s, uint32_t insn)
+static bool do_adc_sbc(DisasContext *s, arg_rrr_sf *a,
+ bool is_sub, bool setflags)
{
- unsigned int sf, op, setflags, rm, rn, rd;
TCGv_i64 tcg_y, tcg_rn, tcg_rd;
- sf = extract32(insn, 31, 1);
- op = extract32(insn, 30, 1);
- setflags = extract32(insn, 29, 1);
- rm = extract32(insn, 16, 5);
- rn = extract32(insn, 5, 5);
- rd = extract32(insn, 0, 5);
+ tcg_rd = cpu_reg(s, a->rd);
+ tcg_rn = cpu_reg(s, a->rn);
- tcg_rd = cpu_reg(s, rd);
- tcg_rn = cpu_reg(s, rn);
-
- if (op) {
+ if (is_sub) {
tcg_y = tcg_temp_new_i64();
- tcg_gen_not_i64(tcg_y, cpu_reg(s, rm));
+ tcg_gen_not_i64(tcg_y, cpu_reg(s, a->rm));
} else {
- tcg_y = cpu_reg(s, rm);
+ tcg_y = cpu_reg(s, a->rm);
}
if (setflags) {
- gen_adc_CC(sf, tcg_rd, tcg_rn, tcg_y);
+ gen_adc_CC(a->sf, tcg_rd, tcg_rn, tcg_y);
} else {
- gen_adc(sf, tcg_rd, tcg_rn, tcg_y);
+ gen_adc(a->sf, tcg_rd, tcg_rn, tcg_y);
}
+ return true;
}
+TRANS(ADC, do_adc_sbc, a, false, false)
+TRANS(SBC, do_adc_sbc, a, true, false)
+TRANS(ADCS, do_adc_sbc, a, false, true)
+TRANS(SBCS, do_adc_sbc, a, true, true)
+
/*
* Rotate right into flags
* 31 30 29 21 15 10 5 4 0
@@ -8305,10 +8297,6 @@ static void disas_data_proc_reg(DisasContext *s,
uint32_t insn)
switch (op2) {
case 0x0:
switch (op3) {
- case 0x00: /* Add/subtract (with carry) */
- disas_adc_sbc(s, insn);
- break;
-
case 0x01: /* Rotate right into flags */
case 0x21:
disas_rotate_right_into_flags(s, insn);
@@ -8322,6 +8310,7 @@ static void disas_data_proc_reg(DisasContext *s, uint32_t
insn)
break;
default:
+ case 0x00: /* Add/subtract (with carry) */
goto do_unallocated;
}
break;
diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode
index b0cc8bd476..7a40ca455e 100644
--- a/target/arm/tcg/a64.decode
+++ b/target/arm/tcg/a64.decode
@@ -746,6 +746,12 @@ ADDS_ext . 01 01011001 ..... ... ... ..... .....
@addsub_ext
SUBS_ext . 11 01011001 ..... ... ... ..... ..... @addsub_ext
# Add/subtract (carry)
+
+ADC . 00 11010000 ..... 000000 ..... ..... @rrr_sf
+ADCS . 01 11010000 ..... 000000 ..... ..... @rrr_sf
+SBC . 10 11010000 ..... 000000 ..... ..... @rrr_sf
+SBCS . 11 11010000 ..... 000000 ..... ..... @rrr_sf
+
# Rotate right into flags
# Evaluate into flags
# Conditional compare (regster)
--
2.43.0
- [PATCH v3 03/69] target/arm: Convert LSLV, LSRV, ASRV, RORV to decodetree, (continued)
- [PATCH v3 03/69] target/arm: Convert LSLV, LSRV, ASRV, RORV to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 02/69] target/arm: Convert UDIV, SDIV to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 04/69] target/arm: Convert CRC32, CRC32C to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 05/69] target/arm: Convert SUBP, IRG, GMI to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 08/69] target/arm: Convert CLZ, CLS to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 07/69] target/arm: Convert RBIT, REV16, REV32, REV64 to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 09/69] target/arm: Convert PAC[ID]*, AUT[ID]* to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 06/69] target/arm: Convert PACGA to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 11/69] target/arm: Convert disas_logic_reg to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 13/69] target/arm: Convert disas_add_sub_reg to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 15/69] target/arm: Convert disas_adc_sbc to decodetree,
Richard Henderson <=
- [PATCH v3 16/69] target/arm: Convert RMIF to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 17/69] target/arm: Convert SETF8, SETF16 to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 20/69] target/arm: Introduce fp_access_check_scalar_hsd, Richard Henderson, 2024/12/11
- [PATCH v3 14/69] target/arm: Convert disas_data_proc_3src to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 10/69] target/arm: Convert XPAC[ID] to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 12/69] target/arm: Convert disas_add_sub_ext_reg to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 19/69] target/arm: Convert disas_cond_select to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 27/69] target/arm: Convert FSQRT (scalar) to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 25/69] target/arm: Pass fpstatus to vfp_sqrt*, Richard Henderson, 2024/12/11
- [PATCH v3 23/69] target/arm: Fix decode of fp16 vector fabs, fneg, fsqrt, Richard Henderson, 2024/12/11