target-i386: expand cmov via movcond

Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Richard Henderson 2013-01-16 11:00:14 -08:00
parent f32d3781de
commit 57eb0cc854

View File

@ -2417,35 +2417,30 @@ static inline void gen_jcc(DisasContext *s, int b,
static void gen_cmovcc1(CPUX86State *env, DisasContext *s, int ot, int b, static void gen_cmovcc1(CPUX86State *env, DisasContext *s, int ot, int b,
int modrm, int reg) int modrm, int reg)
{ {
int l1, mod = (modrm >> 6) & 3; CCPrepare cc;
TCGv t0 = tcg_temp_local_new();
if (mod != 3) { gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0);
int reg_addr, offset_addr;
gen_lea_modrm(env, s, modrm, &reg_addr, &offset_addr); cc = gen_prepare_cc(s, b, cpu_T[1]);
gen_op_ld_v(ot + s->mem_index, t0, cpu_A0); if (cc.mask != -1) {
} else { TCGv t0 = tcg_temp_new();
int rm = (modrm & 7) | REX_B(s); tcg_gen_andi_tl(t0, cc.reg, cc.mask);
gen_op_mov_v_reg(ot, t0, rm); cc.reg = t0;
}
if (!cc.use_reg2) {
cc.reg2 = tcg_const_tl(cc.imm);
} }
l1 = gen_new_label(); tcg_gen_movcond_tl(cc.cond, cpu_T[0], cc.reg, cc.reg2,
gen_jcc1(s, b ^ 1, l1); cpu_T[0], cpu_regs[reg]);
switch (ot) { gen_op_mov_reg_T0(ot, reg);
#ifdef TARGET_X86_64
case OT_LONG:
tcg_gen_mov_tl(cpu_regs[reg], t0);
gen_set_label(l1);
tcg_gen_ext32u_tl(cpu_regs[reg], cpu_regs[reg]);
break;
#endif
default:
gen_op_mov_reg_v(ot, reg, t0);
gen_set_label(l1);
break;
}
tcg_temp_free(t0); if (cc.mask != -1) {
tcg_temp_free(cc.reg);
}
if (!cc.use_reg2) {
tcg_temp_free(cc.reg2);
}
} }
static inline void gen_op_movl_T0_seg(int seg_reg) static inline void gen_op_movl_T0_seg(int seg_reg)