[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 11/60] target/arm: Split out set_btype_raw
From: |
Richard Henderson |
Subject: |
[PATCH v3 11/60] target/arm: Split out set_btype_raw |
Date: |
Sun, 17 Apr 2022 10:43:37 -0700 |
Common code for reset_btype and set_btype.
Use tcg_constant_i32.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate-a64.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index be7283b966..a85ca380a9 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -128,29 +128,28 @@ static int get_a64_user_mem_index(DisasContext *s)
return arm_to_core_mmu_idx(useridx);
}
-static void reset_btype(DisasContext *s)
+static void set_btype_raw(int val)
{
- if (s->btype != 0) {
- TCGv_i32 zero = tcg_const_i32(0);
- tcg_gen_st_i32(zero, cpu_env, offsetof(CPUARMState, btype));
- tcg_temp_free_i32(zero);
- s->btype = 0;
- }
+ tcg_gen_st_i32(tcg_constant_i32(val), cpu_env,
+ offsetof(CPUARMState, btype));
}
static void set_btype(DisasContext *s, int val)
{
- TCGv_i32 tcg_val;
-
/* BTYPE is a 2-bit field, and 0 should be done with reset_btype. */
tcg_debug_assert(val >= 1 && val <= 3);
-
- tcg_val = tcg_const_i32(val);
- tcg_gen_st_i32(tcg_val, cpu_env, offsetof(CPUARMState, btype));
- tcg_temp_free_i32(tcg_val);
+ set_btype_raw(val);
s->btype = -1;
}
+static void reset_btype(DisasContext *s)
+{
+ if (s->btype != 0) {
+ set_btype_raw(0);
+ s->btype = 0;
+ }
+}
+
void gen_a64_set_pc_im(uint64_t val)
{
tcg_gen_movi_i64(cpu_pc, val);
--
2.25.1
- Re: [PATCH v3 09/60] target/arm: Change CPUArchState.thumb to bool, (continued)
- [PATCH v3 19/60] target/arm: Use tcg_constant in translate-neon.c, Richard Henderson, 2022/04/17
- [PATCH v3 16/60] target/arm: Simplify aa32 DISAS_WFI, Richard Henderson, 2022/04/17
- [PATCH v3 15/60] target/arm: Simplify gen_sar, Richard Henderson, 2022/04/17
- [PATCH v3 07/60] target/arm: Extend store_cpu_offset to take field size, Richard Henderson, 2022/04/17
- [PATCH v3 11/60] target/arm: Split out set_btype_raw,
Richard Henderson <=
- [PATCH v3 14/60] target/arm: Simplify GEN_SHIFT in translate.c, Richard Henderson, 2022/04/17
- [PATCH v3 10/60] target/arm: Remove fpexc32_access, Richard Henderson, 2022/04/17
- [PATCH v3 12/60] target/arm: Split out gen_rebuild_hflags, Richard Henderson, 2022/04/17
- [PATCH v3 13/60] target/arm: Use tcg_constant in translate-a64.c, Richard Henderson, 2022/04/17
- [PATCH v3 20/60] target/arm: Use smin/smax for do_sat_addsub_32, Richard Henderson, 2022/04/17