[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 08/23] target/sparc: Use tcg_gen_movcond_i64 in gen_edge
From: |
Richard Henderson |
Subject: |
[PATCH v2 08/23] target/sparc: Use tcg_gen_movcond_i64 in gen_edge |
Date: |
Fri, 18 Aug 2023 15:13:12 -0700 |
The setcond + neg + or sequence is a complex method of
performing a conditional move.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sparc/translate.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index bd877a5e4a..fa80a91161 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -2916,7 +2916,7 @@ static void gen_edge(DisasContext *dc, TCGv dst, TCGv s1,
TCGv s2,
tcg_gen_shr_tl(lo1, tcg_constant_tl(tabl), lo1);
tcg_gen_shr_tl(lo2, tcg_constant_tl(tabr), lo2);
- tcg_gen_andi_tl(dst, lo1, omask);
+ tcg_gen_andi_tl(lo1, lo1, omask);
tcg_gen_andi_tl(lo2, lo2, omask);
amask = -8;
@@ -2926,18 +2926,9 @@ static void gen_edge(DisasContext *dc, TCGv dst, TCGv
s1, TCGv s2,
tcg_gen_andi_tl(s1, s1, amask);
tcg_gen_andi_tl(s2, s2, amask);
- /* We want to compute
- dst = (s1 == s2 ? lo1 : lo1 & lo2).
- We've already done dst = lo1, so this reduces to
- dst &= (s1 == s2 ? -1 : lo2)
- Which we perform by
- lo2 |= -(s1 == s2)
- dst &= lo2
- */
- tcg_gen_setcond_tl(TCG_COND_EQ, lo1, s1, s2);
- tcg_gen_neg_tl(lo1, lo1);
- tcg_gen_or_tl(lo2, lo2, lo1);
- tcg_gen_and_tl(dst, dst, lo2);
+ /* Compute dst = (s1 == s2 ? lo1 : lo1 & lo2). */
+ tcg_gen_and_tl(lo2, lo2, lo1);
+ tcg_gen_movcond_tl(TCG_COND_EQ, dst, s1, s2, lo1, lo2);
}
static void gen_alignaddr(TCGv dst, TCGv s1, TCGv s2, bool left)
--
2.34.1
- [PATCH v2 00/23] tcg: Introduce negsetcond opcodes, Richard Henderson, 2023/08/18
- [PATCH v2 03/23] target/alpha: Use tcg_gen_movcond_i64 in gen_fold_mzero, Richard Henderson, 2023/08/18
- [PATCH v2 02/23] tcg: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 01/23] tcg: Introduce negsetcond opcodes, Richard Henderson, 2023/08/18
- [PATCH v2 04/23] target/arm: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 05/23] target/m68k: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 06/23] target/openrisc: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 08/23] target/sparc: Use tcg_gen_movcond_i64 in gen_edge,
Richard Henderson <=
- [PATCH v2 09/23] target/tricore: Replace gen_cond_w with tcg_gen_negsetcond_tl, Richard Henderson, 2023/08/18
- [PATCH v2 10/23] tcg/ppc: Implement negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 07/23] target/ppc: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 11/23] tcg/ppc: Use the Set Boolean Extension, Richard Henderson, 2023/08/18
- [PATCH v2 12/23] tcg/aarch64: Implement negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 13/23] tcg/arm: Implement negsetcond_i32, Richard Henderson, 2023/08/18
- [PATCH v2 14/23] tcg/riscv: Implement negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 15/23] tcg/s390x: Implement negsetcond_*, Richard Henderson, 2023/08/18
- [PATCH v2 16/23] tcg/sparc64: Implement negsetcond_*, Richard Henderson, 2023/08/18