[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 18/38 1/2] tcg/aarch64: Massage tcg_out_brcond()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 18/38 1/2] tcg/aarch64: Massage tcg_out_brcond() |
Date: |
Fri, 19 Jan 2024 23:47:36 +0100 |
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>
---
tcg/aarch64/tcg-target.c.inc | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
index 70df250c04..a19158f4ea 100644
--- a/tcg/aarch64/tcg-target.c.inc
+++ b/tcg/aarch64/tcg-target.c.inc
@@ -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();
+ }
}
}
--
2.41.0
- [PATCH v3 08/38] target/alpha: Pass immediate value to gen_bcond_internal(), (continued)
- [PATCH v3 08/38] target/alpha: Pass immediate value to gen_bcond_internal(), Richard Henderson, 2024/01/10
- [PATCH v3 10/38] target/alpha: Use TCG_COND_TST{EQ, NE} for CMOVLB{C, S}, Richard Henderson, 2024/01/10
- [PATCH v3 09/38] target/alpha: Use TCG_COND_TST{EQ,NE} for BLB{C,S}, Richard Henderson, 2024/01/10
- [PATCH v3 11/38] target/alpha: Use TCG_COND_TSTNE for gen_fold_mzero, Richard Henderson, 2024/01/10
- [PATCH v3 14/38] target/s390x: Use TCG_COND_TSTNE for CC_OP_{TM,ICM}, Richard Henderson, 2024/01/10
- [PATCH v3 16/38] tcg: Add TCGConst argument to tcg_target_const_match, Richard Henderson, 2024/01/10
- [PATCH v3 18/38] tcg/aarch64: Generate TBZ, TBNZ, Richard Henderson, 2024/01/10
- [PATCH v3 13/38] target/sparc: Use TCG_COND_TSTEQ in gen_op_mulscc, Richard Henderson, 2024/01/10
- [PATCH v3 15/38] target/s390x: Improve general case of disas_jcc, Richard Henderson, 2024/01/10
- [PATCH v3 15/38 1/6] target/s390x: Reorder CC_OP_STATIC switch case in disas_jcc (1/5), Philippe Mathieu-Daudé, 2024/01/19
- [PATCH v3 15/38 2/6] target/s390x: Reorder CC_OP_STATIC switch case in disas_jcc (2/5), Philippe Mathieu-Daudé, 2024/01/19
- [PATCH v3 15/38 3/6] target/s390x: Reorder CC_OP_STATIC switch case in disas_jcc (3/5), Philippe Mathieu-Daudé, 2024/01/19