[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 36/63] tcg/i386: Support bswap flags
From: |
Richard Henderson |
Subject: |
[PULL 36/63] tcg/i386: Support bswap flags |
Date: |
Tue, 29 Jun 2021 11:54:28 -0700 |
Retain the current rorw bswap16 expansion for the zero-in/zero-out case.
Otherwise, perform a wider bswap plus a right-shift or extend.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/i386/tcg-target.c.inc | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index 34113388ef..98d924b91a 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -2421,10 +2421,28 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc,
break;
OP_32_64(bswap16):
- tcg_out_rolw_8(s, a0);
+ if (a2 & TCG_BSWAP_OS) {
+ /* Output must be sign-extended. */
+ if (rexw) {
+ tcg_out_bswap64(s, a0);
+ tcg_out_shifti(s, SHIFT_SAR + rexw, a0, 48);
+ } else {
+ tcg_out_bswap32(s, a0);
+ tcg_out_shifti(s, SHIFT_SAR, a0, 16);
+ }
+ } else if ((a2 & (TCG_BSWAP_IZ | TCG_BSWAP_OZ)) == TCG_BSWAP_OZ) {
+ /* Output must be zero-extended, but input isn't. */
+ tcg_out_bswap32(s, a0);
+ tcg_out_shifti(s, SHIFT_SHR, a0, 16);
+ } else {
+ tcg_out_rolw_8(s, a0);
+ }
break;
OP_32_64(bswap32):
tcg_out_bswap32(s, a0);
+ if (rexw && (a2 & TCG_BSWAP_OS)) {
+ tcg_out_ext32s(s, a0, a0);
+ }
break;
OP_32_64(neg):
--
2.25.1
- [PULL 10/63] target/avr: Add DisasContextBase to DisasContext, (continued)
- [PULL 10/63] target/avr: Add DisasContextBase to DisasContext, Richard Henderson, 2021/06/29
- [PULL 14/63] target/cris: Remove DISAS_SWI, Richard Henderson, 2021/06/29
- [PULL 30/63] tcg: Add tcg_gen_vec_add{sub}8_i32, Richard Henderson, 2021/06/29
- [PULL 25/63] target/cris: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2021/06/29
- [PULL 31/63] tcg: Add tcg_gen_vec_shl{shr}{sar}16i_i32, Richard Henderson, 2021/06/29
- [PULL 32/63] tcg: Add tcg_gen_vec_shl{shr}{sar}8i_i32, Richard Henderson, 2021/06/29
- [PULL 28/63] target/cris: Do not exit tb for X_FLAG changes, Richard Henderson, 2021/06/29
- [PULL 35/63] tcg: Add flags argument to bswap opcodes, Richard Henderson, 2021/06/29
- [PULL 34/63] tcg: Use correct trap number for page faults on *BSD systems, Richard Henderson, 2021/06/29
- [PULL 16/63] target/cris: Mark exceptions as DISAS_NORETURN, Richard Henderson, 2021/06/29
- [PULL 36/63] tcg/i386: Support bswap flags,
Richard Henderson <=
- [PULL 38/63] tcg/aarch64: Support bswap flags, Richard Henderson, 2021/06/29
- [PULL 39/63] tcg/arm: Support bswap flags, Richard Henderson, 2021/06/29
- [PULL 33/63] tcg: Implement tcg_gen_vec_add{sub}32_tl, Richard Henderson, 2021/06/29
- [PULL 37/63] tcg/aarch64: Merge tcg_out_rev{16,32,64}, Richard Henderson, 2021/06/29
- [PULL 40/63] tcg/ppc: Split out tcg_out_ext{8,16,32}s, Richard Henderson, 2021/06/29
- [PULL 41/63] tcg/ppc: Split out tcg_out_sari{32,64}, Richard Henderson, 2021/06/29
- [PULL 45/63] tcg/ppc: Support bswap flags, Richard Henderson, 2021/06/29
- [PULL 42/63] tcg/ppc: Split out tcg_out_bswap16, Richard Henderson, 2021/06/29
- [PULL 43/63] tcg/ppc: Split out tcg_out_bswap32, Richard Henderson, 2021/06/29
- [PULL 44/63] tcg/ppc: Split out tcg_out_bswap64, Richard Henderson, 2021/06/29