target/i386: unify choice between single and repeated string instructions
The same "if" is present in all generator functions for string instructions. Push it inside gen_repz() and gen_repz_nz() instead. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Link: https://lore.kernel.org/r/20241215090613.89588-5-pbonzini@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b519556f58
commit
d8d552d459
@ -1743,11 +1743,7 @@ static void gen_CMPccXADD(DisasContext *s, X86DecodedInsn *decode)
|
|||||||
static void gen_CMPS(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_CMPS(DisasContext *s, X86DecodedInsn *decode)
|
||||||
{
|
{
|
||||||
MemOp ot = decode->op[2].ot;
|
MemOp ot = decode->op[2].ot;
|
||||||
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
gen_repz_nz(s, ot, gen_cmps);
|
||||||
gen_repz_nz(s, ot, gen_cmps);
|
|
||||||
} else {
|
|
||||||
gen_cmps(s, ot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_CMPXCHG(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_CMPXCHG(DisasContext *s, X86DecodedInsn *decode)
|
||||||
@ -2238,11 +2234,7 @@ static void gen_INS(DisasContext *s, X86DecodedInsn *decode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
translator_io_start(&s->base);
|
translator_io_start(&s->base);
|
||||||
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
gen_repz(s, ot, gen_ins);
|
||||||
gen_repz(s, ot, gen_ins);
|
|
||||||
} else {
|
|
||||||
gen_ins(s, ot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_INSERTQ_i(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_INSERTQ_i(DisasContext *s, X86DecodedInsn *decode)
|
||||||
@ -2426,11 +2418,7 @@ static void gen_LGS(DisasContext *s, X86DecodedInsn *decode)
|
|||||||
static void gen_LODS(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_LODS(DisasContext *s, X86DecodedInsn *decode)
|
||||||
{
|
{
|
||||||
MemOp ot = decode->op[1].ot;
|
MemOp ot = decode->op[1].ot;
|
||||||
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
gen_repz(s, ot, gen_lods);
|
||||||
gen_repz(s, ot, gen_lods);
|
|
||||||
} else {
|
|
||||||
gen_lods(s, ot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_LOOP(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_LOOP(DisasContext *s, X86DecodedInsn *decode)
|
||||||
@ -2628,11 +2616,7 @@ static void gen_MOVq_dq(DisasContext *s, X86DecodedInsn *decode)
|
|||||||
static void gen_MOVS(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_MOVS(DisasContext *s, X86DecodedInsn *decode)
|
||||||
{
|
{
|
||||||
MemOp ot = decode->op[2].ot;
|
MemOp ot = decode->op[2].ot;
|
||||||
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
gen_repz(s, ot, gen_movs);
|
||||||
gen_repz(s, ot, gen_movs);
|
|
||||||
} else {
|
|
||||||
gen_movs(s, ot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_MUL(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_MUL(DisasContext *s, X86DecodedInsn *decode)
|
||||||
@ -2794,11 +2778,7 @@ static void gen_OUTS(DisasContext *s, X86DecodedInsn *decode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
translator_io_start(&s->base);
|
translator_io_start(&s->base);
|
||||||
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
gen_repz(s, ot, gen_outs);
|
||||||
gen_repz(s, ot, gen_outs);
|
|
||||||
} else {
|
|
||||||
gen_outs(s, ot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_PALIGNR(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_PALIGNR(DisasContext *s, X86DecodedInsn *decode)
|
||||||
@ -3879,11 +3859,7 @@ static void gen_SBB(DisasContext *s, X86DecodedInsn *decode)
|
|||||||
static void gen_SCAS(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_SCAS(DisasContext *s, X86DecodedInsn *decode)
|
||||||
{
|
{
|
||||||
MemOp ot = decode->op[2].ot;
|
MemOp ot = decode->op[2].ot;
|
||||||
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
gen_repz_nz(s, ot, gen_scas);
|
||||||
gen_repz_nz(s, ot, gen_scas);
|
|
||||||
} else {
|
|
||||||
gen_scas(s, ot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_SETcc(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_SETcc(DisasContext *s, X86DecodedInsn *decode)
|
||||||
@ -4089,11 +4065,7 @@ static void gen_STMXCSR(DisasContext *s, X86DecodedInsn *decode)
|
|||||||
static void gen_STOS(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_STOS(DisasContext *s, X86DecodedInsn *decode)
|
||||||
{
|
{
|
||||||
MemOp ot = decode->op[1].ot;
|
MemOp ot = decode->op[1].ot;
|
||||||
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
gen_repz(s, ot, gen_stos);
|
||||||
gen_repz(s, ot, gen_stos);
|
|
||||||
} else {
|
|
||||||
gen_stos(s, ot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_SUB(DisasContext *s, X86DecodedInsn *decode)
|
static void gen_SUB(DisasContext *s, X86DecodedInsn *decode)
|
||||||
|
@ -1341,13 +1341,21 @@ static void gen_repz(DisasContext *s, MemOp ot,
|
|||||||
void (*fn)(DisasContext *s, MemOp ot))
|
void (*fn)(DisasContext *s, MemOp ot))
|
||||||
|
|
||||||
{
|
{
|
||||||
do_gen_rep(s, ot, fn, false);
|
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
||||||
|
do_gen_rep(s, ot, fn, false);
|
||||||
|
} else {
|
||||||
|
fn(s, ot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_repz_nz(DisasContext *s, MemOp ot,
|
static void gen_repz_nz(DisasContext *s, MemOp ot,
|
||||||
void (*fn)(DisasContext *s, MemOp ot))
|
void (*fn)(DisasContext *s, MemOp ot))
|
||||||
{
|
{
|
||||||
do_gen_rep(s, ot, fn, true);
|
if (s->prefix & (PREFIX_REPZ | PREFIX_REPNZ)) {
|
||||||
|
do_gen_rep(s, ot, fn, true);
|
||||||
|
} else {
|
||||||
|
fn(s, ot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_helper_fp_arith_ST0_FT0(int op)
|
static void gen_helper_fp_arith_ST0_FT0(int op)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user