target-ppc: Use NARROW_MODE macro for comparisons

Removing conditional compilation in the process.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Richard Henderson 2013-03-21 10:01:47 +00:00 committed by Alexander Graf
parent e0c8f9ce85
commit 02765534f7

View File

@ -632,7 +632,6 @@ static inline void gen_op_cmpi(TCGv arg0, target_ulong arg1, int s, int crf)
tcg_temp_free(t0); tcg_temp_free(t0);
} }
#if defined(TARGET_PPC64)
static inline void gen_op_cmp32(TCGv arg0, TCGv arg1, int s, int crf) static inline void gen_op_cmp32(TCGv arg0, TCGv arg1, int s, int crf)
{ {
TCGv t0, t1; TCGv t0, t1;
@ -656,68 +655,62 @@ static inline void gen_op_cmpi32(TCGv arg0, target_ulong arg1, int s, int crf)
gen_op_cmp32(arg0, t0, s, crf); gen_op_cmp32(arg0, t0, s, crf);
tcg_temp_free(t0); tcg_temp_free(t0);
} }
#endif
static inline void gen_set_Rc0(DisasContext *ctx, TCGv reg) static inline void gen_set_Rc0(DisasContext *ctx, TCGv reg)
{ {
#if defined(TARGET_PPC64) if (NARROW_MODE(ctx)) {
if (!(ctx->sf_mode))
gen_op_cmpi32(reg, 0, 1, 0); gen_op_cmpi32(reg, 0, 1, 0);
else } else {
#endif
gen_op_cmpi(reg, 0, 1, 0); gen_op_cmpi(reg, 0, 1, 0);
}
} }
/* cmp */ /* cmp */
static void gen_cmp(DisasContext *ctx) static void gen_cmp(DisasContext *ctx)
{ {
#if defined(TARGET_PPC64) if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
if (!(ctx->sf_mode && (ctx->opcode & 0x00200000)))
gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)],
1, crfD(ctx->opcode)); 1, crfD(ctx->opcode));
else } else {
#endif
gen_op_cmp(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], gen_op_cmp(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)],
1, crfD(ctx->opcode)); 1, crfD(ctx->opcode));
}
} }
/* cmpi */ /* cmpi */
static void gen_cmpi(DisasContext *ctx) static void gen_cmpi(DisasContext *ctx)
{ {
#if defined(TARGET_PPC64) if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
if (!(ctx->sf_mode && (ctx->opcode & 0x00200000)))
gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], SIMM(ctx->opcode), gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], SIMM(ctx->opcode),
1, crfD(ctx->opcode)); 1, crfD(ctx->opcode));
else } else {
#endif
gen_op_cmpi(cpu_gpr[rA(ctx->opcode)], SIMM(ctx->opcode), gen_op_cmpi(cpu_gpr[rA(ctx->opcode)], SIMM(ctx->opcode),
1, crfD(ctx->opcode)); 1, crfD(ctx->opcode));
}
} }
/* cmpl */ /* cmpl */
static void gen_cmpl(DisasContext *ctx) static void gen_cmpl(DisasContext *ctx)
{ {
#if defined(TARGET_PPC64) if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
if (!(ctx->sf_mode && (ctx->opcode & 0x00200000)))
gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], gen_op_cmp32(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)],
0, crfD(ctx->opcode)); 0, crfD(ctx->opcode));
else } else {
#endif
gen_op_cmp(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)], gen_op_cmp(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rB(ctx->opcode)],
0, crfD(ctx->opcode)); 0, crfD(ctx->opcode));
}
} }
/* cmpli */ /* cmpli */
static void gen_cmpli(DisasContext *ctx) static void gen_cmpli(DisasContext *ctx)
{ {
#if defined(TARGET_PPC64) if (NARROW_MODE(ctx) || !(ctx->opcode & 0x00200000)) {
if (!(ctx->sf_mode && (ctx->opcode & 0x00200000)))
gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], UIMM(ctx->opcode), gen_op_cmpi32(cpu_gpr[rA(ctx->opcode)], UIMM(ctx->opcode),
0, crfD(ctx->opcode)); 0, crfD(ctx->opcode));
else } else {
#endif
gen_op_cmpi(cpu_gpr[rA(ctx->opcode)], UIMM(ctx->opcode), gen_op_cmpi(cpu_gpr[rA(ctx->opcode)], UIMM(ctx->opcode),
0, crfD(ctx->opcode)); 0, crfD(ctx->opcode));
}
} }
/* isel (PowerPC 2.03 specification) */ /* isel (PowerPC 2.03 specification) */
@ -761,11 +754,9 @@ static inline void gen_op_arith_compute_ov(DisasContext *ctx, TCGv arg0,
tcg_gen_andc_tl(cpu_ov, cpu_ov, t0); tcg_gen_andc_tl(cpu_ov, cpu_ov, t0);
} }
tcg_temp_free(t0); tcg_temp_free(t0);
#if defined(TARGET_PPC64) if (NARROW_MODE(ctx)) {
if (!ctx->sf_mode) {
tcg_gen_ext32s_tl(cpu_ov, cpu_ov); tcg_gen_ext32s_tl(cpu_ov, cpu_ov);
} }
#endif
tcg_gen_shri_tl(cpu_ov, cpu_ov, TARGET_LONG_BITS - 1); tcg_gen_shri_tl(cpu_ov, cpu_ov, TARGET_LONG_BITS - 1);
tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov); tcg_gen_or_tl(cpu_so, cpu_so, cpu_ov);
} }