[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 30/73] tcg/i386: Handle all 8-bit extensions for i686
From: |
Richard Henderson |
Subject: |
[PATCH 30/73] tcg/i386: Handle all 8-bit extensions for i686 |
Date: |
Thu, 2 Jan 2025 10:06:10 -0800 |
When we generalize {s}extract_i32, we'll lose the
specific register constraints on ext8u and ext8s.
It's just as easy to emit a couple of insns instead.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/i386/tcg-target.c.inc | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index 167228a781..b7a8b3880c 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1329,16 +1329,31 @@ static inline void tcg_out_rolw_8(TCGContext *s, int
reg)
static void tcg_out_ext8u(TCGContext *s, TCGReg dest, TCGReg src)
{
- /* movzbl */
- tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64);
+ if (TCG_TARGET_REG_BITS == 32 && src >= 4) {
+ tcg_out_mov(s, TCG_TYPE_I32, dest, src);
+ if (dest >= 4) {
+ tcg_out_modrm(s, OPC_ARITH_EvIz, ARITH_AND, dest);
+ tcg_out32(s, 0xff);
+ return;
+ }
+ src = dest;
+ }
tcg_out_modrm(s, OPC_MOVZBL + P_REXB_RM, dest, src);
}
static void tcg_out_ext8s(TCGContext *s, TCGType type, TCGReg dest, TCGReg src)
{
int rexw = type == TCG_TYPE_I32 ? 0 : P_REXW;
- /* movsbl */
- tcg_debug_assert(src < 4 || TCG_TARGET_REG_BITS == 64);
+
+ if (TCG_TARGET_REG_BITS == 32 && src >= 4) {
+ tcg_out_mov(s, TCG_TYPE_I32, dest, src);
+ if (dest >= 4) {
+ tcg_out_shifti(s, SHIFT_SHL, dest, 24);
+ tcg_out_shifti(s, SHIFT_SAR, dest, 24);
+ return;
+ }
+ src = dest;
+ }
tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src);
}
--
2.43.0
- Re: [PATCH 10/73] target/tricore: Use tcg_op_supported, (continued)
- [PATCH 20/73] tcg: Split out tcg-target-mo.h, Richard Henderson, 2025/01/02
- [PATCH 24/73] tcg: Merge TCG_TARGET_HAS_bswap*, Richard Henderson, 2025/01/02
- [PATCH 27/73] tcg: Merge TCG_TARGET_HAS_{muls2,mulu2,mulsh,muluh}, Richard Henderson, 2025/01/02
- [PATCH 12/73] target/i386: Remove TCG_TARGET_extract_tl_valid, Richard Henderson, 2025/01/02
- [PATCH 30/73] tcg/i386: Handle all 8-bit extensions for i686,
Richard Henderson <=
- [PATCH 25/73] tcg: Merge TCG_TARGET_HAS_rot_{i32,i64}, Richard Henderson, 2025/01/02
- [PATCH 26/73] tcg: Merge TCG_TARGET_HAS_{clz,ctz,ctpop}, Richard Henderson, 2025/01/02
- [PATCH 29/73] tcg: Merge TCG_TARGET_HAS_negsetcond_{i32,i64}, Richard Henderson, 2025/01/02
- [PATCH 34/73] tcg/arm: Add full [US]XT[BH] into {s}extract, Richard Henderson, 2025/01/02
- [PATCH 36/73] tcg/mips: Fold the ext{8, 16, 32}[us] cases into {s}extract, Richard Henderson, 2025/01/02
- [PATCH 39/73] tcg/riscv: Use SRAIW, SRLIW for {s}extract_i64, Richard Henderson, 2025/01/02
- [PATCH 40/73] tcg/s390x: Fold the ext{8, 16, 32}[us] cases into {s}extract, Richard Henderson, 2025/01/02
- [PATCH 52/73] tcg: Use tcg_op_supported in process_op_defs, Richard Henderson, 2025/01/02
- [PATCH 57/73] tcg: Add TCGType argument to tcg_out_op, Richard Henderson, 2025/01/02