[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 20/28] target/arm: Improve REV32
From: |
Richard Henderson |
Subject: |
[PATCH 20/28] target/arm: Improve REV32 |
Date: |
Mon, 14 Jun 2021 01:37:52 -0700 |
For the sf version, we are performing two 32-bit bswaps
in either half of the register. This is equivalent to
performing one 64-bit bswap followed by a rotate.
For the non-sf version, we can remove TCG_BSWAP_IZ
and the preceding zero-extension.
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate-a64.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index e0785ce859..ea9d2d4647 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -5430,22 +5430,13 @@ static void handle_rev32(DisasContext *s, unsigned int
sf,
unsigned int rn, unsigned int rd)
{
TCGv_i64 tcg_rd = cpu_reg(s, rd);
+ TCGv_i64 tcg_rn = cpu_reg(s, rn);
if (sf) {
- TCGv_i64 tcg_tmp = tcg_temp_new_i64();
- TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf);
-
- /* bswap32_i64 requires zero high word */
- tcg_gen_ext32u_i64(tcg_tmp, tcg_rn);
- tcg_gen_bswap32_i64(tcg_rd, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
- tcg_gen_shri_i64(tcg_tmp, tcg_rn, 32);
- tcg_gen_bswap32_i64(tcg_tmp, tcg_tmp, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
- tcg_gen_concat32_i64(tcg_rd, tcg_rd, tcg_tmp);
-
- tcg_temp_free_i64(tcg_tmp);
+ tcg_gen_bswap64_i64(tcg_rd, tcg_rn);
+ tcg_gen_rotri_i64(tcg_rd, tcg_rd, 32);
} else {
- tcg_gen_ext32u_i64(tcg_rd, cpu_reg(s, rn));
- tcg_gen_bswap32_i64(tcg_rd, tcg_rd, TCG_BSWAP_IZ | TCG_BSWAP_OZ);
+ tcg_gen_bswap32_i64(tcg_rd, tcg_rn, TCG_BSWAP_OZ);
}
}
--
2.25.1
- Re: [PATCH 17/28] tcg: Add flags argument to tcg_gen_bswap16_*, tcg_gen_bswap32_i64, (continued)
- [PATCH 18/28] tcg: Make use of bswap flags in tcg_gen_qemu_ld_*, Richard Henderson, 2021/06/14
- [PATCH 09/28] tcg/ppc: Split out tcg_out_bswap64, Richard Henderson, 2021/06/14
- [PATCH 11/28] tcg/ppc: Use power10 byte-reverse instructions, Richard Henderson, 2021/06/14
- [PATCH 16/28] tcg: Handle new bswap flags during optimize, Richard Henderson, 2021/06/14
- [PATCH 15/28] tcg/tci: Support bswap flags, Richard Henderson, 2021/06/14
- [PATCH 20/28] target/arm: Improve REV32,
Richard Henderson <=
- [PATCH 19/28] tcg: Make use of bswap flags in tcg_gen_qemu_st_*, Richard Henderson, 2021/06/14
- [PATCH 25/28] target/mips: Fix gen_mxu_s32ldd_s32lddr, Richard Henderson, 2021/06/14
- [PATCH 27/28] tcg/aarch64: Unset TCG_TARGET_HAS_MEMORY_BSWAP, Richard Henderson, 2021/06/14
- [PATCH 12/28] tcg/s390: Support bswap flags, Richard Henderson, 2021/06/14
- [PATCH 21/28] target/arm: Improve vector REV, Richard Henderson, 2021/06/14