mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 11:04:58 -06:00
tcg/s390x: Create tgen_cmp2 to simplify movcond
Return both regular and inverted condition codes from tgen_cmp2. This lets us choose after the fact which comparision we want. Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
6c9b5c0f53
commit
5c837bbca6
1 changed files with 16 additions and 3 deletions
|
@ -1207,10 +1207,11 @@ static void tgen_xori(TCGContext *s, TCGReg dest, uint64_t val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
|
static int tgen_cmp2(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
|
||||||
TCGArg c2, bool c2const, bool need_carry)
|
TCGArg c2, bool c2const, bool need_carry, int *inv_cc)
|
||||||
{
|
{
|
||||||
bool is_unsigned = is_unsigned_cond(c);
|
bool is_unsigned = is_unsigned_cond(c);
|
||||||
|
TCGCond inv_c = tcg_invert_cond(c);
|
||||||
S390Opcode op;
|
S390Opcode op;
|
||||||
|
|
||||||
if (c2const) {
|
if (c2const) {
|
||||||
|
@ -1221,6 +1222,7 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
|
||||||
} else {
|
} else {
|
||||||
tcg_out_insn(s, RRE, LTGR, r1, r1);
|
tcg_out_insn(s, RRE, LTGR, r1, r1);
|
||||||
}
|
}
|
||||||
|
*inv_cc = tcg_cond_to_ltr_cond[inv_c];
|
||||||
return tcg_cond_to_ltr_cond[c];
|
return tcg_cond_to_ltr_cond[c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1263,9 +1265,17 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
*inv_cc = tcg_cond_to_s390_cond[inv_c];
|
||||||
return tcg_cond_to_s390_cond[c];
|
return tcg_cond_to_s390_cond[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
|
||||||
|
TCGArg c2, bool c2const, bool need_carry)
|
||||||
|
{
|
||||||
|
int inv_cc;
|
||||||
|
return tgen_cmp2(s, type, c, r1, c2, c2const, need_carry, &inv_cc);
|
||||||
|
}
|
||||||
|
|
||||||
static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
|
static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond,
|
||||||
TCGReg dest, TCGReg c1, TCGArg c2, int c2const)
|
TCGReg dest, TCGReg c1, TCGArg c2, int c2const)
|
||||||
{
|
{
|
||||||
|
@ -1348,7 +1358,10 @@ static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest,
|
||||||
TCGReg c1, TCGArg c2, int c2const,
|
TCGReg c1, TCGArg c2, int c2const,
|
||||||
TCGArg v3, int v3const)
|
TCGArg v3, int v3const)
|
||||||
{
|
{
|
||||||
int cc = tgen_cmp(s, type, c, c1, c2, c2const, false);
|
int cc, inv_cc;
|
||||||
|
|
||||||
|
cc = tgen_cmp2(s, type, c, c1, c2, c2const, false, &inv_cc);
|
||||||
|
|
||||||
if (v3const) {
|
if (v3const) {
|
||||||
tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc);
|
tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue