[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/48] tcg/ppc: Use the Set Boolean Extension
From: |
Richard Henderson |
Subject: |
[PULL 26/48] tcg/ppc: Use the Set Boolean Extension |
Date: |
Wed, 23 Aug 2023 13:23:04 -0700 |
The SETBC family of instructions requires exactly two insns for
all comparisions, saving 0-3 insns per (neg)setcond.
Tested-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/ppc/tcg-target.c.inc | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
index 10448aa0e6..090f11e71c 100644
--- a/tcg/ppc/tcg-target.c.inc
+++ b/tcg/ppc/tcg-target.c.inc
@@ -447,6 +447,11 @@ static bool tcg_target_const_match(int64_t val, TCGType
type, int ct)
#define TW XO31( 4)
#define TRAP (TW | TO(31))
+#define SETBC XO31(384) /* v3.10 */
+#define SETBCR XO31(416) /* v3.10 */
+#define SETNBC XO31(448) /* v3.10 */
+#define SETNBCR XO31(480) /* v3.10 */
+
#define NOP ORI /* ori 0,0,0 */
#define LVX XO31(103)
@@ -1624,6 +1629,23 @@ static void tcg_out_setcond(TCGContext *s, TCGType type,
TCGCond cond,
arg2 = (uint32_t)arg2;
}
+ /* With SETBC/SETBCR, we can always implement with 2 insns. */
+ if (have_isa_3_10) {
+ tcg_insn_unit bi, opc;
+
+ tcg_out_cmp(s, cond, arg1, arg2, const_arg2, 7, type);
+
+ /* Re-use tcg_to_bc for BI and BO_COND_{TRUE,FALSE}. */
+ bi = tcg_to_bc[cond] & (0x1f << 16);
+ if (tcg_to_bc[cond] & BO(8)) {
+ opc = neg ? SETNBC : SETBC;
+ } else {
+ opc = neg ? SETNBCR : SETBCR;
+ }
+ tcg_out32(s, opc | RT(arg0) | bi);
+ return;
+ }
+
/* Handle common and trivial cases before handling anything else. */
if (arg2 == 0) {
switch (cond) {
--
2.34.1
- [PULL 20/48] target/m68k: Use tcg_gen_negsetcond_*, (continued)
- [PULL 20/48] target/m68k: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/23
- [PULL 19/48] target/arm: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/23
- [PULL 37/48] tcg/i386: Use shift in tcg_out_setcond, Richard Henderson, 2023/08/23
- [PULL 36/48] tcg/i386: Clear dest first in tcg_out_setcond if possible, Richard Henderson, 2023/08/23
- [PULL 13/48] tcg/i386: Allow immediate as input to deposit_*, Richard Henderson, 2023/08/23
- [PULL 14/48] docs/devel/tcg-ops: Bury mentions of trunc_shr_i64_i32(), Richard Henderson, 2023/08/23
- [PULL 07/48] include/exec: Widen tlb_hit/tlb_hit_page(), Richard Henderson, 2023/08/23
- [PULL 09/48] accel/tcg: Update run_on_cpu_data static assert, Richard Henderson, 2023/08/23
- [PULL 15/48] tcg: Unify TCG_TARGET_HAS_extr[lh]_i64_i32, Richard Henderson, 2023/08/23
- [PULL 23/48] target/sparc: Use tcg_gen_movcond_i64 in gen_edge, Richard Henderson, 2023/08/23
- [PULL 26/48] tcg/ppc: Use the Set Boolean Extension,
Richard Henderson <=
- [PULL 28/48] tcg/arm: Implement negsetcond_i32, Richard Henderson, 2023/08/23
- [PULL 22/48] target/ppc: Use tcg_gen_negsetcond_*, Richard Henderson, 2023/08/23
- [PULL 38/48] tcg/i386: Implement negsetcond_*, Richard Henderson, 2023/08/23
- [PULL 40/48] tcg/tcg-op: Document bswap16_i64() byte pattern, Richard Henderson, 2023/08/23
- [PULL 41/48] tcg/tcg-op: Document bswap32_i32() byte pattern, Richard Henderson, 2023/08/23
- [PULL 44/48] tcg/tcg-op: Document hswap_i32/64() byte pattern, Richard Henderson, 2023/08/23
- [PULL 45/48] tcg/tcg-op: Document wswap_i64() byte pattern, Richard Henderson, 2023/08/23
- [PULL 42/48] tcg/tcg-op: Document bswap32_i64() byte pattern, Richard Henderson, 2023/08/23
- [PULL 43/48] tcg/tcg-op: Document bswap64_i64() byte pattern, Richard Henderson, 2023/08/23
- [PULL 47/48] docs/devel/tcg-ops: fix missing newlines in "Host vector operations", Richard Henderson, 2023/08/23