target/nios2: Split out helpers for gen_i_cmpxx
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>
This commit is contained in:
parent
1746338ed6
commit
3d1f63d019
@ -71,6 +71,18 @@ typedef struct {
|
|||||||
.a = extract32((code), 27, 5), \
|
.a = extract32((code), 27, 5), \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef target_ulong ImmFromIType(const InstrIType *);
|
||||||
|
|
||||||
|
static target_ulong imm_unsigned(const InstrIType *i)
|
||||||
|
{
|
||||||
|
return i->imm16.u;
|
||||||
|
}
|
||||||
|
|
||||||
|
static target_ulong imm_signed(const InstrIType *i)
|
||||||
|
{
|
||||||
|
return i->imm16.s;
|
||||||
|
}
|
||||||
|
|
||||||
/* R-Type instruction parsing */
|
/* R-Type instruction parsing */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t op;
|
uint8_t op;
|
||||||
@ -268,15 +280,23 @@ static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Comparison instructions */
|
/* Comparison instructions */
|
||||||
#define gen_i_cmpxx(fname, op3) \
|
static void do_i_cmpxx(DisasContext *dc, uint32_t insn,
|
||||||
static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \
|
TCGCond cond, ImmFromIType *imm)
|
||||||
{ \
|
{
|
||||||
I_TYPE(instr, (code)); \
|
I_TYPE(instr, insn);
|
||||||
tcg_gen_setcondi_tl(flags, cpu_R[instr.b], cpu_R[instr.a], (op3)); \
|
|
||||||
|
if (likely(instr.b != R_ZERO)) {
|
||||||
|
tcg_gen_setcondi_tl(cond, cpu_R[instr.b],
|
||||||
|
load_gpr(dc, instr.a), imm(&instr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_i_cmpxx(gen_cmpxxsi, instr.imm16.s)
|
#define gen_i_cmpxx(fname, imm) \
|
||||||
gen_i_cmpxx(gen_cmpxxui, instr.imm16.u)
|
static void (fname)(DisasContext *dc, uint32_t code, uint32_t flags) \
|
||||||
|
{ do_i_cmpxx(dc, code, flags, imm); }
|
||||||
|
|
||||||
|
gen_i_cmpxx(gen_cmpxxsi, imm_signed)
|
||||||
|
gen_i_cmpxx(gen_cmpxxui, imm_unsigned)
|
||||||
|
|
||||||
/* Math/logic instructions */
|
/* Math/logic instructions */
|
||||||
#define gen_i_math_logic(fname, insn, resimm, op3) \
|
#define gen_i_math_logic(fname, insn, resimm, op3) \
|
||||||
|
Loading…
Reference in New Issue
Block a user