From: David Gibson <david@gibson.dropbear.id.au>
To: Vitaly Chikunov <vt@altlinux.org>
Cc: qemu-stable@nongnu.org, Richard Henderson <rth@twiddle.net>,
qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org
Subject: Re: [PATCH] target/ppc: Fix rlwinm on ppc64
Date: Tue, 10 Mar 2020 13:34:38 +1100 [thread overview]
Message-ID: <20200310023438.GG660117@umbus.fritz.box> (raw)
In-Reply-To: <20200309204557.14836-1-vt@altlinux.org>
[-- Attachment #1: Type: text/plain, Size: 2434 bytes --]
On Mon, Mar 09, 2020 at 11:45:57PM +0300, Vitaly Chikunov wrote:
> 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>
Adding Richard Henderson to CC, since he knows the most about ppc
target TCG.
> ---
> 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 36fa27367c..127c82a24e 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);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-03-10 2:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 20:45 [PATCH] target/ppc: Fix rlwinm on ppc64 Vitaly Chikunov
2020-03-09 22:15 ` no-reply
2020-03-10 2:34 ` David Gibson [this message]
2020-03-10 4:13 ` Richard Henderson
2020-03-10 23:15 ` David Gibson
2020-03-11 13:00 ` Vitaly Chikunov
2020-03-16 2:57 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200310023438.GG660117@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=rth@twiddle.net \
--cc=vt@altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).