[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/85] target/arm: Convert disas_adc_sbc to decodetree
From: |
Peter Maydell |
Subject: |
[PULL 15/85] target/arm: Convert disas_adc_sbc to decodetree |
Date: |
Fri, 13 Dec 2024 17:31:19 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
This includes ADC, SBC, ADCS, SBCS.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20241211163036.2297116-16-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/tcg/a64.decode | 6 +++++
target/arm/tcg/translate-a64.c | 43 +++++++++++++---------------------
2 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode
index b0cc8bd476e..7a40ca455e4 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)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 99ff787c61f..d7747fcf575 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;
--
2.34.1
- [PULL 00/85] target-arm queue, Peter Maydell, 2024/12/13
- [PULL 02/85] target/arm: Convert UDIV, SDIV to decodetree, Peter Maydell, 2024/12/13
- [PULL 13/85] target/arm: Convert disas_add_sub_reg to decodetree, Peter Maydell, 2024/12/13
- [PULL 17/85] target/arm: Convert SETF8, SETF16 to decodetree, Peter Maydell, 2024/12/13
- [PULL 01/85] target/arm: Add section labels for "Data Processing (register)", Peter Maydell, 2024/12/13
- [PULL 06/85] target/arm: Convert PACGA to decodetree, Peter Maydell, 2024/12/13
- [PULL 15/85] target/arm: Convert disas_adc_sbc to decodetree,
Peter Maydell <=
- [PULL 20/85] target/arm: Introduce fp_access_check_scalar_hsd, Peter Maydell, 2024/12/13
- [PULL 21/85] target/arm: Introduce fp_access_check_vector_hsd, Peter Maydell, 2024/12/13
- [PULL 05/85] target/arm: Convert SUBP, IRG, GMI to decodetree, Peter Maydell, 2024/12/13
- [PULL 04/85] target/arm: Convert CRC32, CRC32C to decodetree, Peter Maydell, 2024/12/13
- [PULL 03/85] target/arm: Convert LSLV, LSRV, ASRV, RORV to decodetree, Peter Maydell, 2024/12/13
- [PULL 08/85] target/arm: Convert CLZ, CLS to decodetree, Peter Maydell, 2024/12/13
- [PULL 22/85] target/arm: Convert FCMP, FCMPE, FCCMP, FCCMPE to decodetree, Peter Maydell, 2024/12/13
- [PULL 24/85] target/arm: Convert FMOV, FABS, FNEG (scalar) to decodetree, Peter Maydell, 2024/12/13
- [PULL 29/85] target/arm: Convert BFCVT to decodetree, Peter Maydell, 2024/12/13
- [PULL 33/85] target/arm: Convert FJCVTZS to decodetree, Peter Maydell, 2024/12/13