[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/23] target/arm: Convert CFINV, XAFLAG and AXFLAG to decodet
From: |
Peter Maydell |
Subject: |
[PATCH v2 07/23] target/arm: Convert CFINV, XAFLAG and AXFLAG to decodetree |
Date: |
Sun, 11 Jun 2023 17:00:16 +0100 |
Convert the CFINV, XAFLAG and AXFLAG insns to decodetree.
The old decoder handles these in handle_msr_i(), but
the architecture defines them as separate instructions
from MSR (immediate).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230602155223.2040685-5-peter.maydell@linaro.org
---
target/arm/tcg/a64.decode | 6 ++++
target/arm/tcg/translate-a64.c | 53 +++++++++++++++++-----------------
2 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode
index b3608d38dc9..fd23fc3e0ff 100644
--- a/target/arm/tcg/a64.decode
+++ b/target/arm/tcg/a64.decode
@@ -188,3 +188,9 @@ CLREX 1101 0101 0000 0011 0011 ---- 010 11111
DSB_DMB 1101 0101 0000 0011 0011 domain:2 types:2 10- 11111
ISB 1101 0101 0000 0011 0011 ---- 110 11111
SB 1101 0101 0000 0011 0011 0000 111 11111
+
+# PSTATE
+
+CFINV 1101 0101 0000 0 000 0100 0000 000 11111
+XAFLAG 1101 0101 0000 0 000 0100 0000 001 11111
+AXFLAG 1101 0101 0000 0 000 0100 0000 010 11111
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 088dfd8b1fd..c1b02b96183 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -1864,9 +1864,24 @@ static bool trans_SB(DisasContext *s, arg_SB *a)
return true;
}
-static void gen_xaflag(void)
+static bool trans_CFINV(DisasContext *s, arg_CFINV *a)
{
- TCGv_i32 z = tcg_temp_new_i32();
+ if (!dc_isar_feature(aa64_condm_4, s)) {
+ return false;
+ }
+ tcg_gen_xori_i32(cpu_CF, cpu_CF, 1);
+ return true;
+}
+
+static bool trans_XAFLAG(DisasContext *s, arg_XAFLAG *a)
+{
+ TCGv_i32 z;
+
+ if (!dc_isar_feature(aa64_condm_5, s)) {
+ return false;
+ }
+
+ z = tcg_temp_new_i32();
tcg_gen_setcondi_i32(TCG_COND_EQ, z, cpu_ZF, 0);
@@ -1890,10 +1905,16 @@ static void gen_xaflag(void)
/* C | Z */
tcg_gen_or_i32(cpu_CF, cpu_CF, z);
+
+ return true;
}
-static void gen_axflag(void)
+static bool trans_AXFLAG(DisasContext *s, arg_AXFLAG *a)
{
+ if (!dc_isar_feature(aa64_condm_5, s)) {
+ return false;
+ }
+
tcg_gen_sari_i32(cpu_VF, cpu_VF, 31); /* V ? -1 : 0 */
tcg_gen_andc_i32(cpu_CF, cpu_CF, cpu_VF); /* C & !V */
@@ -1902,6 +1923,8 @@ static void gen_axflag(void)
tcg_gen_movi_i32(cpu_NF, 0);
tcg_gen_movi_i32(cpu_VF, 0);
+
+ return true;
}
/* MSR (immediate) - move immediate to processor state field */
@@ -1914,30 +1937,6 @@ static void handle_msr_i(DisasContext *s, uint32_t insn,
s->base.is_jmp = DISAS_TOO_MANY;
switch (op) {
- case 0x00: /* CFINV */
- if (crm != 0 || !dc_isar_feature(aa64_condm_4, s)) {
- goto do_unallocated;
- }
- tcg_gen_xori_i32(cpu_CF, cpu_CF, 1);
- s->base.is_jmp = DISAS_NEXT;
- break;
-
- case 0x01: /* XAFlag */
- if (crm != 0 || !dc_isar_feature(aa64_condm_5, s)) {
- goto do_unallocated;
- }
- gen_xaflag();
- s->base.is_jmp = DISAS_NEXT;
- break;
-
- case 0x02: /* AXFlag */
- if (crm != 0 || !dc_isar_feature(aa64_condm_5, s)) {
- goto do_unallocated;
- }
- gen_axflag();
- s->base.is_jmp = DISAS_NEXT;
- break;
-
case 0x03: /* UAO */
if (!dc_isar_feature(aa64_uao, s) || s->current_el == 0) {
goto do_unallocated;
--
2.34.1
- Re: [PATCH v2 03/23] target/arm: Pass memop to gen_mte_check1_mmuidx() in reg_imm9 decode, (continued)
- [PATCH v2 01/23] target/arm: Fix return value from LDSMIN/LDSMAX 8/16 bit atomics, Peter Maydell, 2023/06/11
- [PATCH v2 08/23] target/arm: Convert MSR (immediate) to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 11/23] target/arm: Convert load/store exclusive and ordered to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 16/23] target/arm: Convert LDR/STR with 12-bit immediate to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 22/23] target/arm: Convert load/store single structure to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 13/23] target/arm: Convert load reg (literal) group to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 09/23] target/arm: Convert MSR (reg), MRS, SYS, SYSL to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 07/23] target/arm: Convert CFINV, XAFLAG and AXFLAG to decodetree,
Peter Maydell <=
- [PATCH v2 06/23] target/arm: Convert barrier insns to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 04/23] target/arm: Consistently use finalize_memop_asimd() for ASIMD loads/stores, Peter Maydell, 2023/06/11
- [PATCH v2 10/23] target/arm: Convert exception generation instructions to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 12/23] target/arm: Convert LDXP, STXP, CASP, CAS to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 17/23] target/arm: Convert LDR/STR reg+reg to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 14/23] target/arm: Convert load/store-pair to decodetree, Peter Maydell, 2023/06/11
- [PATCH v2 18/23] target/arm: Convert atomic memory ops to decodetree, Peter Maydell, 2023/06/11