tcg/aarch64: Massage tcg_out_brcond()

In order to ease next commit review, modify tcg_out_brcond()
to switch over TCGCond. No logical change intended.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240119224737.48943-1-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2024-01-19 23:47:36 +01:00 committed by Richard Henderson
parent 339adf2f38
commit a0f5b3fc27

View File

@ -1416,12 +1416,20 @@ static void tcg_out_brcond(TCGContext *s, TCGType ext, TCGCond c, TCGArg a,
TCGArg b, bool b_const, TCGLabel *l)
{
intptr_t offset;
bool need_cmp;
bool need_cmp = true;
if (b_const && b == 0 && (c == TCG_COND_EQ || c == TCG_COND_NE)) {
need_cmp = false;
} else {
need_cmp = true;
switch (c) {
case TCG_COND_EQ:
case TCG_COND_NE:
if (b_const && b == 0) {
need_cmp = false;
}
break;
default:
break;
}
if (need_cmp) {
tcg_out_cmp(s, ext, c, a, b, b_const);
}
@ -1435,10 +1443,17 @@ static void tcg_out_brcond(TCGContext *s, TCGType ext, TCGCond c, TCGArg a,
if (need_cmp) {
tcg_out_insn(s, 3202, B_C, c, offset);
} else if (c == TCG_COND_EQ) {
tcg_out_insn(s, 3201, CBZ, ext, a, offset);
} else {
tcg_out_insn(s, 3201, CBNZ, ext, a, offset);
switch (c) {
case TCG_COND_EQ:
tcg_out_insn(s, 3201, CBZ, ext, a, offset);
break;
case TCG_COND_NE:
tcg_out_insn(s, 3201, CBNZ, ext, a, offset);
break;
default:
g_assert_not_reached();
}
}
}