target-m68k: Replace helper_xflag_lt with setcond

Backports commit f9083519034aaa5ad5cd2c5727bd61c29bf60bc5 from qemu
This commit is contained in:
Laurent Vivier 2018-02-27 08:50:41 -05:00 committed by Lioncash
parent b079255576
commit a521f4f41d
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 7 additions and 13 deletions

View file

@ -378,11 +378,6 @@ uint32_t HELPER(addx_cc)(CPUM68KState *env, uint32_t op1, uint32_t op2)
return res; return res;
} }
uint32_t HELPER(xflag_lt)(uint32_t a, uint32_t b)
{
return a < b;
}
void HELPER(set_sr)(CPUM68KState *env, uint32_t val) void HELPER(set_sr)(CPUM68KState *env, uint32_t val)
{ {
env->sr = val & 0xffff; env->sr = val & 0xffff;

View file

@ -10,7 +10,6 @@ DEF_HELPER_3(subx_cc, i32, env, i32, i32)
DEF_HELPER_3(shl_cc, i32, env, i32, i32) DEF_HELPER_3(shl_cc, i32, env, i32, i32)
DEF_HELPER_3(shr_cc, i32, env, i32, i32) DEF_HELPER_3(shr_cc, i32, env, i32, i32)
DEF_HELPER_3(sar_cc, i32, env, i32, i32) DEF_HELPER_3(sar_cc, i32, env, i32, i32)
DEF_HELPER_2(xflag_lt, i32, i32, i32)
DEF_HELPER_2(set_sr, void, env, i32) DEF_HELPER_2(set_sr, void, env, i32)
DEF_HELPER_3(movec, void, env, i32, i32) DEF_HELPER_3(movec, void, env, i32, i32)

View file

@ -1029,10 +1029,10 @@ DISAS_INSN(addsub)
} }
if (add) { if (add) {
tcg_gen_add_i32(tcg_ctx, dest, tmp, src); tcg_gen_add_i32(tcg_ctx, dest, tmp, src);
gen_helper_xflag_lt(tcg_ctx, tcg_ctx->QREG_CC_X, dest, src); tcg_gen_setcond_i32(tcg_ctx, TCG_COND_LTU, tcg_ctx->QREG_CC_X, dest, src);
s->cc_op = CC_OP_ADD; s->cc_op = CC_OP_ADD;
} else { } else {
gen_helper_xflag_lt(tcg_ctx, tcg_ctx->QREG_CC_X, tmp, src); tcg_gen_setcond_i32(tcg_ctx, TCG_COND_LTU, tcg_ctx->QREG_CC_X, tmp, src);
tcg_gen_sub_i32(tcg_ctx, dest, tmp, src); tcg_gen_sub_i32(tcg_ctx, dest, tmp, src);
s->cc_op = CC_OP_SUB; s->cc_op = CC_OP_SUB;
} }
@ -1252,7 +1252,7 @@ DISAS_INSN(arith_im)
break; break;
case 2: /* subi */ case 2: /* subi */
tcg_gen_mov_i32(tcg_ctx, dest, src1); tcg_gen_mov_i32(tcg_ctx, dest, src1);
gen_helper_xflag_lt(tcg_ctx, tcg_ctx->QREG_CC_X, dest, tcg_const_i32(tcg_ctx, im)); tcg_gen_setcond_i32(tcg_ctx, TCG_COND_LTU, tcg_ctx->QREG_CC_X, dest, tcg_const_i32(tcg_ctx, im));
tcg_gen_subi_i32(tcg_ctx, dest, dest, im); tcg_gen_subi_i32(tcg_ctx, dest, dest, im);
gen_update_cc_add(s, dest, tcg_const_i32(tcg_ctx, im)); gen_update_cc_add(s, dest, tcg_const_i32(tcg_ctx, im));
s->cc_op = CC_OP_SUB; s->cc_op = CC_OP_SUB;
@ -1261,7 +1261,7 @@ DISAS_INSN(arith_im)
tcg_gen_mov_i32(tcg_ctx, dest, src1); tcg_gen_mov_i32(tcg_ctx, dest, src1);
tcg_gen_addi_i32(tcg_ctx, dest, dest, im); tcg_gen_addi_i32(tcg_ctx, dest, dest, im);
gen_update_cc_add(s, dest, tcg_const_i32(tcg_ctx, im)); gen_update_cc_add(s, dest, tcg_const_i32(tcg_ctx, im));
gen_helper_xflag_lt(tcg_ctx, tcg_ctx->QREG_CC_X, dest, tcg_const_i32(tcg_ctx, im)); tcg_gen_setcond_i32(tcg_ctx, TCG_COND_LTU, tcg_ctx->QREG_CC_X, dest, tcg_const_i32(tcg_ctx, im));
s->cc_op = CC_OP_ADD; s->cc_op = CC_OP_ADD;
break; break;
case 5: /* eori */ case 5: /* eori */
@ -1399,7 +1399,7 @@ DISAS_INSN(neg)
tcg_gen_neg_i32(tcg_ctx, reg, src1); tcg_gen_neg_i32(tcg_ctx, reg, src1);
s->cc_op = CC_OP_SUB; s->cc_op = CC_OP_SUB;
gen_update_cc_add(s, reg, src1); gen_update_cc_add(s, reg, src1);
gen_helper_xflag_lt(tcg_ctx, tcg_ctx->QREG_CC_X, tcg_const_i32(tcg_ctx, 0), src1); tcg_gen_setcond_i32(tcg_ctx, TCG_COND_LTU, tcg_ctx->QREG_CC_X, tcg_const_i32(tcg_ctx, 0), src1);
s->cc_op = CC_OP_SUB; s->cc_op = CC_OP_SUB;
} }
@ -1659,12 +1659,12 @@ DISAS_INSN(addsubq)
} else { } else {
src2 = tcg_const_i32(tcg_ctx, val); src2 = tcg_const_i32(tcg_ctx, val);
if (insn & 0x0100) { if (insn & 0x0100) {
gen_helper_xflag_lt(tcg_ctx, tcg_ctx->QREG_CC_X, dest, src2); tcg_gen_setcond_i32(tcg_ctx, TCG_COND_LTU, tcg_ctx->QREG_CC_X, dest, src2);
tcg_gen_subi_i32(tcg_ctx, dest, dest, val); tcg_gen_subi_i32(tcg_ctx, dest, dest, val);
s->cc_op = CC_OP_SUB; s->cc_op = CC_OP_SUB;
} else { } else {
tcg_gen_addi_i32(tcg_ctx, dest, dest, val); tcg_gen_addi_i32(tcg_ctx, dest, dest, val);
gen_helper_xflag_lt(tcg_ctx, tcg_ctx->QREG_CC_X, dest, src2); tcg_gen_setcond_i32(tcg_ctx, TCG_COND_LTU, tcg_ctx->QREG_CC_X, dest, src2);
s->cc_op = CC_OP_ADD; s->cc_op = CC_OP_ADD;
} }
gen_update_cc_add(s, dest, src2); gen_update_cc_add(s, dest, src2);