On 6/8/24 01:41, Paolo Bonzini wrote:
- if (mod != 3) { - AddressParts a = gen_lea_modrm_0(env, s, modrm); - /* specific case: we need to add a displacement */ - gen_exts(ot, s->T1); - tcg_gen_sari_tl(s->tmp0, s->T1, 3 + ot); - tcg_gen_shli_tl(s->tmp0, s->tmp0, ot); - tcg_gen_add_tl(s->A0, gen_lea_modrm_1(s, a, false), s->tmp0);
This is not the same as
+ if (decode->e.special == X86_SPECIAL_BitTest) { + int oplen = 3 + decode->op[0].ot; + int poslen = 8 << decode->op[2].ot; + TCGv ofs = tcg_temp_new(); + + /* Extract memory displacement from T1. */ + assert (decode->op[2].unit == X86_OP_INT); + tcg_gen_sextract_tl(ofs, s->T1, oplen, poslen - oplen); + + tcg_gen_add_tl(s->A0, ea, ofs);
... this. Combining the exts + sari into an sextract is fine, but this has lost the shli. r~