[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 55/78] target/ppc: Fix rlwinm on ppc64
From: |
Michael Roth |
Subject: |
[PATCH 55/78] target/ppc: Fix rlwinm on ppc64 |
Date: |
Tue, 16 Jun 2020 09:15:24 -0500 |
From: Vitaly Chikunov <vt@altlinux.org>
rlwinm cannot just AND with Mask if shift value is zero on ppc64 when
Mask Begin is greater than Mask End and high bits are set to 1.
Note that PowerISA 3.0B says that for `rlwinm' ROTL32 is used, and
ROTL32 is defined (in 3.3.14) so that rotated value should have two
copies of lower word of the source value.
This seems to be another incarnation of the fix from 820724d170
("target-ppc: Fix rlwimi, rlwinm, rlwnm again"), except I leave
optimization when Mask value is less than 32 bits.
Fixes: 7b4d326f47 ("target-ppc: Use the new deposit and extract ops")
Cc: qemu-stable@nongnu.org
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Message-Id: <20200309204557.14836-1-vt@altlinux.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
(cherry picked from commit 94f040aaecf4e41cc68991b80204b1b6886bbdd0)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
target/ppc/translate.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index f5fe5d0611..f87f6eeaf7 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -1938,15 +1938,17 @@ static void gen_rlwinm(DisasContext *ctx)
me += 32;
#endif
mask = MASK(mb, me);
- if (sh == 0) {
- tcg_gen_andi_tl(t_ra, t_rs, mask);
- } else if (mask <= 0xffffffffu) {
- TCGv_i32 t0 = tcg_temp_new_i32();
- tcg_gen_trunc_tl_i32(t0, t_rs);
- tcg_gen_rotli_i32(t0, t0, sh);
- tcg_gen_andi_i32(t0, t0, mask);
- tcg_gen_extu_i32_tl(t_ra, t0);
- tcg_temp_free_i32(t0);
+ if (mask <= 0xffffffffu) {
+ if (sh == 0) {
+ tcg_gen_andi_tl(t_ra, t_rs, mask);
+ } else {
+ TCGv_i32 t0 = tcg_temp_new_i32();
+ tcg_gen_trunc_tl_i32(t0, t_rs);
+ tcg_gen_rotli_i32(t0, t0, sh);
+ tcg_gen_andi_i32(t0, t0, mask);
+ tcg_gen_extu_i32_tl(t_ra, t0);
+ tcg_temp_free_i32(t0);
+ }
} else {
#if defined(TARGET_PPC64)
tcg_gen_deposit_i64(t_ra, t_rs, t_rs, 32, 32);
--
2.17.1
- [PATCH 46/78] iotests: Test copy offloading with external data file, (continued)
- [PATCH 46/78] iotests: Test copy offloading with external data file, Michael Roth, 2020/06/16
- [PATCH 03/78] i386: Resolve CPU models to v1 by default, Michael Roth, 2020/06/16
- [PATCH 48/78] iotests/026: Test EIO on preallocated zero cluster, Michael Roth, 2020/06/16
- [PATCH 49/78] iotests/026: Test EIO on allocation in a data-file, Michael Roth, 2020/06/16
- [PATCH 50/78] virtio: gracefully handle invalid region caches, Michael Roth, 2020/06/16
- [PATCH 51/78] scsi/qemu-pr-helper: Fix out-of-bounds access to trnptid_list[], Michael Roth, 2020/06/16
- [PATCH 04/78] qapi: better document NVMe blockdev @device parameter, Michael Roth, 2020/06/16
- [PATCH 52/78] block/qcow2-threads: fix qcow2_decompress, Michael Roth, 2020/06/16
- [PATCH 53/78] job: refactor progress to separate object, Michael Roth, 2020/06/16
- [PATCH 54/78] block/block-copy: fix progress calculation, Michael Roth, 2020/06/16
- [PATCH 55/78] target/ppc: Fix rlwinm on ppc64,
Michael Roth <=
- [PATCH 57/78] compat: disable edid on correct virtio-gpu device, Michael Roth, 2020/06/16
- [PATCH 56/78] block/io: fix bdrv_co_do_copy_on_readv, Michael Roth, 2020/06/16
- [PATCH 58/78] qga: Installer: Wait for installation to finish, Michael Roth, 2020/06/16
- [PATCH 59/78] qga-win: Handle VSS_E_PROVIDER_ALREADY_REGISTERED error, Michael Roth, 2020/06/16
- [PATCH 05/78] target/arm: ensure we use current exception state after SCR update, Michael Roth, 2020/06/16
- [PATCH 60/78] qga-win: prevent crash when executing guest-file-read with large count, Michael Roth, 2020/06/16
- [PATCH 61/78] qga: Fix undefined C behavior, Michael Roth, 2020/06/16
- [PATCH 62/78] qemu-ga: document vsock-listen in the man page, Michael Roth, 2020/06/16
- [PATCH 63/78] hw/i386/amd_iommu.c: Fix corruption of log events passed to guest, Michael Roth, 2020/06/16
- [PATCH 64/78] tcg/i386: Fix INDEX_op_dup2_vec, Michael Roth, 2020/06/16