[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 48/68] target/nios2: Split out helpers for gen_rr_shift
From: |
Richard Henderson |
Subject: |
[PULL 48/68] target/nios2: Split out helpers for gen_rr_shift |
Date: |
Tue, 26 Apr 2022 11:18:47 -0700 |
Do as little work as possible within the macro.
Split out helper functions and pass in arguments instead.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/nios2/translate.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index 5979427c8e..f2dcaa3fbb 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -690,23 +690,28 @@ gen_rr_mul_high(mulxss, muls2)
gen_rr_mul_high(mulxuu, mulu2)
gen_rr_mul_high(mulxsu, mulsu2)
-#define gen_r_shift_s(fname, insn) \
-static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \
-{ \
- R_TYPE(instr, (code)); \
- if (likely(instr.c != R_ZERO)) { \
- TCGv t0 = tcg_temp_new(); \
- tcg_gen_andi_tl(t0, load_gpr((dc), instr.b), 31); \
- tcg_gen_##insn(cpu_R[instr.c], load_gpr((dc), instr.a), t0); \
- tcg_temp_free(t0); \
- } \
+static void do_rr_shift(DisasContext *dc, uint32_t insn, GenFn3 *fn)
+{
+ R_TYPE(instr, insn);
+
+ if (likely(instr.c != R_ZERO)) {
+ TCGv sh = tcg_temp_new();
+
+ tcg_gen_andi_tl(sh, load_gpr(dc, instr.b), 31);
+ fn(cpu_R[instr.c], load_gpr(dc, instr.a), sh);
+ tcg_temp_free(sh);
+ }
}
-gen_r_shift_s(sra, sar_tl)
-gen_r_shift_s(srl, shr_tl)
-gen_r_shift_s(sll, shl_tl)
-gen_r_shift_s(rol, rotl_tl)
-gen_r_shift_s(ror, rotr_tl)
+#define gen_rr_shift(fname, insn) \
+ static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \
+ { do_rr_shift(dc, code, tcg_gen_##insn##_tl); }
+
+gen_rr_shift(sra, sar)
+gen_rr_shift(srl, shr)
+gen_rr_shift(sll, shl)
+gen_rr_shift(rol, rotl)
+gen_rr_shift(ror, rotr)
static void divs(DisasContext *dc, uint32_t code, uint32_t flags)
{
--
2.34.1
- [PULL 50/68] target/nios2: Drop CR_STATUS_EH from tb->flags, (continued)
- [PULL 50/68] target/nios2: Drop CR_STATUS_EH from tb->flags, Richard Henderson, 2022/04/26
- [PULL 52/68] target/nios2: Create gen_jumpr, Richard Henderson, 2022/04/26
- [PULL 57/68] target/nios2: Introduce shadow register sets, Richard Henderson, 2022/04/26
- [PULL 55/68] target/nios2: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2022/04/26
- [PULL 59/68] target/nios2: Update helper_eret for shadow registers, Richard Henderson, 2022/04/26
- [PULL 60/68] target/nios2: Implement EIC interrupt processing, Richard Henderson, 2022/04/26
- [PULL 61/68] target/nios2: Advance pc when raising exceptions, Richard Henderson, 2022/04/26
- [PULL 62/68] linux-user/nios2: Handle various SIGILL exceptions, Richard Henderson, 2022/04/26
- [PULL 65/68] hw/nios2: Move memory regions into Nios2Machine, Richard Henderson, 2022/04/26
- [PULL 68/68] tests/tcg/nios2: Add test-shadow-1, Richard Henderson, 2022/04/26
- [PULL 48/68] target/nios2: Split out helpers for gen_rr_shift,
Richard Henderson <=
- [PULL 67/68] tests/tcg/nios2: Add semihosting multiarch tests, Richard Henderson, 2022/04/26
- [PULL 47/68] target/nios2: Split out helpers for gen_rr_mul_high, Richard Henderson, 2022/04/26
- [PULL 58/68] target/nios2: Implement rdprs, wrprs, Richard Henderson, 2022/04/26
- [PULL 63/68] hw/intc: Vectored Interrupt Controller (VIC), Richard Henderson, 2022/04/26
- [PULL 66/68] hw/nios2: Machine with a Vectored Interrupt Controller, Richard Henderson, 2022/04/26
- Re: [PULL 00/68] nios2 patch queue, Richard Henderson, 2022/04/26