Le 15/11/2016 à 21:44, Richard Henderson a écrit : > Signed-off-by: Richard Henderson <r...@twiddle.net>
> diff --git a/target-m68k/translate.c b/target-m68k/translate.c > index bc6ec39..ed40ade 100644 > --- a/target-m68k/translate.c > +++ b/target-m68k/translate.c > @@ -3913,7 +3913,14 @@ DISAS_INSN(bfop_reg) > TCGv src = DREG(insn, 0); > int len = ((extract32(ext, 0, 5) - 1) & 31) + 1; > int ofs = extract32(ext, 6, 5); /* big bit-endian */ > - TCGv mask; > + TCGv mask, tofs, tlen; > + > + TCGV_UNUSED(tofs); > + TCGV_UNUSED(tlen); > + if ((insn & 0x0f00) == 0x0d00) { /* bfffo */ > + tofs = tcg_temp_new(); > + tlen = tcg_temp_new(); > + } > > if ((ext & 0x820) == 0) { > /* Immediate width and offset. */ > @@ -3925,6 +3932,10 @@ DISAS_INSN(bfop_reg) > } > tcg_gen_andi_i32(QREG_CC_N, QREG_CC_N, ~maski); > mask = tcg_const_i32(ror32(maski, ofs)); > + if (!TCGV_IS_UNUSED(tofs)) { > + tcg_gen_movi_i32(tofs, ofs); > + tcg_gen_movi_i32(tlen, len); > + } > } else { > TCGv tmp = tcg_temp_new(); > if (ext & 0x20) { > @@ -3933,9 +3944,15 @@ DISAS_INSN(bfop_reg) > tcg_gen_andi_i32(tmp, tmp, 31); > mask = tcg_const_i32(0x7fffffffu); > tcg_gen_shr_i32(mask, mask, tmp); > + if (!TCGV_IS_UNUSED(tlen)) { > + tcg_gen_mov_i32(tlen, tmp); We must add 1 here, otherwise the value stays between 0 and 31, not 1 and 32: + tcg_gen_addi_i32(tlen, tmp, 1); > + } > } else { > /* Immediate width */ > mask = tcg_const_i32(0x7fffffffu >> (len - 1)); > + if (!TCGV_IS_UNUSED(tlen)) { > + tcg_gen_movi_i32(tlen, len); > + } > } In the case of the immediate value, it is added at beginning of the function: > int len = ((extract32(ext, 0, 5) - 1) & 31) + 1; Laurent