[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 47/68] target/nios2: Split out helpers for gen_rr_mul_high
From: |
Richard Henderson |
Subject: |
[PATCH v8 47/68] target/nios2: Split out helpers for gen_rr_mul_high |
Date: |
Fri, 22 Apr 2022 09:52:17 -0700 |
Rename the macro from gen_r_mul, because these are the multiply
variants that produce a high-part result. Do as little work as
possible within the macro; split out helper functions and pass
in arguments instead.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/nios2/translate.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index 4f52606516..5979427c8e 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -122,6 +122,7 @@ typedef struct {
typedef void GenFn2i(TCGv, TCGv, target_long);
typedef void GenFn3(TCGv, TCGv, TCGv);
+typedef void GenFn4(TCGv, TCGv, TCGv, TCGv);
typedef struct DisasContext {
DisasContextBase base;
@@ -669,21 +670,25 @@ gen_ri_math_logic(srli, shri)
gen_ri_math_logic(slli, shli)
gen_ri_math_logic(roli, rotli)
-#define gen_r_mul(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_##insn(t0, cpu_R[instr.c], \
- load_gpr(dc, instr.a), load_gpr(dc, instr.b)); \
- tcg_temp_free(t0); \
- } \
+static void do_rr_mul_high(DisasContext *dc, uint32_t insn, GenFn4 *fn)
+{
+ R_TYPE(instr, insn);
+
+ if (likely(instr.c != R_ZERO)) {
+ TCGv discard = tcg_temp_new();
+ fn(discard, cpu_R[instr.c], load_gpr(dc, instr.a),
+ load_gpr(dc, instr.b));
+ tcg_temp_free(discard);
+ }
}
-gen_r_mul(mulxss, muls2_tl)
-gen_r_mul(mulxuu, mulu2_tl)
-gen_r_mul(mulxsu, mulsu2_tl)
+#define gen_rr_mul_high(fname, insn) \
+ static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \
+ { do_rr_mul_high(dc, code, tcg_gen_##insn##_tl); }
+
+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) \
--
2.34.1
- [PATCH v8 40/68] target/nios2: Remove CPU_INTERRUPT_NMI, (continued)
- [PATCH v8 40/68] target/nios2: Remove CPU_INTERRUPT_NMI, Richard Henderson, 2022/04/22
- [PATCH v8 41/68] target/nios2: Support division error exception, Richard Henderson, 2022/04/22
- [PATCH v8 42/68] target/nios2: Use tcg_constant_tl, Richard Henderson, 2022/04/22
- [PATCH v8 43/68] target/nios2: Split out named structs for [IRJ]_TYPE, Richard Henderson, 2022/04/22
- [PATCH v8 44/68] target/nios2: Split out helpers for gen_i_cmpxx, Richard Henderson, 2022/04/22
- [PATCH v8 45/68] target/nios2: Split out helpers for gen_i_math_logic, Richard Henderson, 2022/04/22
- [PATCH v8 46/68] target/nios2: Split out helpers for gen_r_math_logic, Richard Henderson, 2022/04/22
- [PATCH v8 47/68] target/nios2: Split out helpers for gen_rr_mul_high,
Richard Henderson <=
- [PATCH v8 48/68] target/nios2: Split out helpers for gen_rr_shift, Richard Henderson, 2022/04/22
- [PATCH v8 49/68] target/nios2: Introduce dest_gpr, Richard Henderson, 2022/04/22
- [PATCH v8 51/68] target/nios2: Enable unaligned traps for system mode, Richard Henderson, 2022/04/22
- [PATCH v8 52/68] target/nios2: Create gen_jumpr, Richard Henderson, 2022/04/22
- [PATCH v8 50/68] target/nios2: Drop CR_STATUS_EH from tb->flags, Richard Henderson, 2022/04/22
- [PATCH v8 54/68] target/nios2: Use gen_goto_tb for DISAS_TOO_MANY, Richard Henderson, 2022/04/22
- [PATCH v8 53/68] target/nios2: Hoist set of is_jmp into gen_goto_tb, Richard Henderson, 2022/04/22
- [PATCH v8 56/68] target/nios2: Implement Misaligned destination exception, Richard Henderson, 2022/04/22