target-m68k: some bit ops cleanup

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Laurent Vivier 2016-01-17 12:51:45 +01:00
parent 415f4b62eb
commit 3c980d2ef6

View File

@ -1290,39 +1290,36 @@ DISAS_INSN(bitop_reg)
else
opsize = OS_LONG;
op = (insn >> 6) & 3;
SRC_EA(env, src1, opsize, 0, op ? &addr: NULL);
gen_flush_flags(s);
SRC_EA(env, src1, opsize, 0, op ? &addr: NULL);
src2 = DREG(insn, 9);
dest = tcg_temp_new();
tmp = tcg_temp_new();
src2 = tcg_temp_new();
if (opsize == OS_BYTE)
tcg_gen_andi_i32(tmp, src2, 7);
tcg_gen_andi_i32(src2, DREG(insn, 9), 7);
else
tcg_gen_andi_i32(tmp, src2, 31);
tcg_gen_andi_i32(src2, DREG(insn, 9), 31);
src2 = tcg_const_i32(1);
tcg_gen_shl_i32(src2, src2, tmp);
tcg_temp_free(tmp);
tmp = tcg_const_i32(1);
tcg_gen_shl_i32(tmp, tmp, src2);
tcg_temp_free(src2);
tcg_gen_and_i32(QREG_CC_Z, src1, src2);
tcg_gen_and_i32(QREG_CC_Z, src1, tmp);
dest = tcg_temp_new();
switch (op) {
case 1: /* bchg */
tcg_gen_xor_i32(dest, src1, src2);
tcg_gen_xor_i32(dest, src1, tmp);
break;
case 2: /* bclr */
tcg_gen_andc_i32(dest, src1, src2);
tcg_gen_andc_i32(dest, src1, tmp);
break;
case 3: /* bset */
tcg_gen_or_i32(dest, src1, src2);
tcg_gen_or_i32(dest, src1, tmp);
break;
default: /* btst */
break;
}
tcg_temp_free(src2);
tcg_temp_free(tmp);
if (op) {
DEST_EA(env, insn, opsize, dest, &addr);
}
@ -1406,17 +1403,16 @@ DISAS_INSN(bitop_im)
return;
}
gen_flush_flags(s);
SRC_EA(env, src1, opsize, 0, op ? &addr: NULL);
gen_flush_flags(s);
if (opsize == OS_BYTE)
bitnum &= 7;
else
bitnum &= 31;
mask = 1 << bitnum;
tcg_gen_andi_i32(QREG_CC_Z, src1, mask);
tcg_gen_andi_i32(QREG_CC_Z, src1, mask);
if (op) {
tmp = tcg_temp_new();