qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>,
	Richard Henderson <rth@twiddle.net>,
	Alexander Graf <agraf@suse.de>,
	qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 7/8] target/ppc: optimize various functions using extract op
Date: Thu, 11 May 2017 10:41:59 +1000	[thread overview]
Message-ID: <20170511004159.GD14408@umbus.fritz.box> (raw)
In-Reply-To: <20170510200535.13268-8-f4bug@amsat.org>

[-- Attachment #1: Type: text/plain, Size: 4655 bytes --]

On Wed, May 10, 2017 at 05:05:34PM -0300, Philippe Mathieu-Daudé wrote:
> Applied using Coccinelle script.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  target/ppc/translate.c              |  9 +++------
>  target/ppc/translate/vsx-impl.inc.c | 21 +++++++--------------
>  2 files changed, 10 insertions(+), 20 deletions(-)
> 
> diff --git a/target/ppc/translate.c b/target/ppc/translate.c
> index f40b5a1abf..64ab412bf3 100644
> --- a/target/ppc/translate.c
> +++ b/target/ppc/translate.c
> @@ -868,8 +868,7 @@ static inline void gen_op_arith_add(DisasContext *ctx, TCGv ret, TCGv arg1,
>              }
>              tcg_gen_xor_tl(cpu_ca, t0, t1);        /* bits changed w/ carry */
>              tcg_temp_free(t1);
> -            tcg_gen_shri_tl(cpu_ca, cpu_ca, 32);   /* extract bit 32 */
> -            tcg_gen_andi_tl(cpu_ca, cpu_ca, 1);
> +            tcg_gen_extract_tl(cpu_ca, cpu_ca, 32, 1);
>              if (is_isa300(ctx)) {
>                  tcg_gen_mov_tl(cpu_ca32, cpu_ca);
>              }
> @@ -1399,8 +1398,7 @@ static inline void gen_op_arith_subf(DisasContext *ctx, TCGv ret, TCGv arg1,
>              tcg_temp_free(inv1);
>              tcg_gen_xor_tl(cpu_ca, t0, t1);         /* bits changes w/ carry */
>              tcg_temp_free(t1);
> -            tcg_gen_shri_tl(cpu_ca, cpu_ca, 32);    /* extract bit 32 */
> -            tcg_gen_andi_tl(cpu_ca, cpu_ca, 1);
> +            tcg_gen_extract_tl(cpu_ca, cpu_ca, 32, 1);
>              if (is_isa300(ctx)) {
>                  tcg_gen_mov_tl(cpu_ca32, cpu_ca);
>              }
> @@ -5383,8 +5381,7 @@ static void gen_mfsri(DisasContext *ctx)
>      CHK_SV;
>      t0 = tcg_temp_new();
>      gen_addr_reg_index(ctx, t0);
> -    tcg_gen_shri_tl(t0, t0, 28);
> -    tcg_gen_andi_tl(t0, t0, 0xF);
> +    tcg_gen_extract_tl(t0, t0, 28, 0xF);
>      gen_helper_load_sr(cpu_gpr[rd], cpu_env, t0);
>      tcg_temp_free(t0);
>      if (ra != 0 && ra != rd)
> diff --git a/target/ppc/translate/vsx-impl.inc.c b/target/ppc/translate/vsx-impl.inc.c
> index 7f12908029..354a6b113a 100644
> --- a/target/ppc/translate/vsx-impl.inc.c
> +++ b/target/ppc/translate/vsx-impl.inc.c
> @@ -1262,8 +1262,7 @@ static void gen_xsxexpqp(DisasContext *ctx)
>          gen_exception(ctx, POWERPC_EXCP_VSXU);
>          return;
>      }
> -    tcg_gen_shri_i64(xth, xbh, 48);
> -    tcg_gen_andi_i64(xth, xth, 0x7FFF);
> +    tcg_gen_extract_i64(xth, xbh, 48, 0x7FFF);
>      tcg_gen_movi_i64(xtl, 0);
>  }
>  
> @@ -1431,10 +1430,8 @@ static void gen_xvxexpsp(DisasContext *ctx)
>          gen_exception(ctx, POWERPC_EXCP_VSXU);
>          return;
>      }
> -    tcg_gen_shri_i64(xth, xbh, 23);
> -    tcg_gen_andi_i64(xth, xth, 0xFF000000FF);
> -    tcg_gen_shri_i64(xtl, xbl, 23);
> -    tcg_gen_andi_i64(xtl, xtl, 0xFF000000FF);
> +    tcg_gen_extract_i64(xth, xbh, 23, 0xFF000000FF);
> +    tcg_gen_extract_i64(xtl, xbl, 23, 0xFF000000FF);
>  }
>  
>  static void gen_xvxexpdp(DisasContext *ctx)
> @@ -1448,10 +1445,8 @@ static void gen_xvxexpdp(DisasContext *ctx)
>          gen_exception(ctx, POWERPC_EXCP_VSXU);
>          return;
>      }
> -    tcg_gen_shri_i64(xth, xbh, 52);
> -    tcg_gen_andi_i64(xth, xth, 0x7FF);
> -    tcg_gen_shri_i64(xtl, xbl, 52);
> -    tcg_gen_andi_i64(xtl, xtl, 0x7FF);
> +    tcg_gen_extract_i64(xth, xbh, 52, 0x7FF);
> +    tcg_gen_extract_i64(xtl, xbl, 52, 0x7FF);
>  }
>  
>  GEN_VSX_HELPER_2(xvxsigsp, 0x00, 0x04, 0, PPC2_ISA300)
> @@ -1474,16 +1469,14 @@ static void gen_xvxsigdp(DisasContext *ctx)
>      zr = tcg_const_i64(0);
>      nan = tcg_const_i64(2047);
>  
> -    tcg_gen_shri_i64(exp, xbh, 52);
> -    tcg_gen_andi_i64(exp, exp, 0x7FF);
> +    tcg_gen_extract_i64(exp, xbh, 52, 0x7FF);
>      tcg_gen_movi_i64(t0, 0x0010000000000000);
>      tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, zr, zr, t0);
>      tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, nan, zr, t0);
>      tcg_gen_andi_i64(xth, xbh, 0x000FFFFFFFFFFFFF);
>      tcg_gen_or_i64(xth, xth, t0);
>  
> -    tcg_gen_shri_i64(exp, xbl, 52);
> -    tcg_gen_andi_i64(exp, exp, 0x7FF);
> +    tcg_gen_extract_i64(exp, xbl, 52, 0x7FF);
>      tcg_gen_movi_i64(t0, 0x0010000000000000);
>      tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, zr, zr, t0);
>      tcg_gen_movcond_i64(TCG_COND_EQ, t0, exp, nan, zr, t0);

-- 
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: 819 bytes --]

  reply	other threads:[~2017-05-11  1:54 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 20:05 [Qemu-devel] [PATCH 0/8] optimize various tcg_gen() functions using extract op Philippe Mathieu-Daudé
2017-05-10 20:05 ` [Qemu-devel] [PATCH 1/8] coccinelle: add a script to optimize tcg op using tcg_gen_extract() Philippe Mathieu-Daudé
2017-05-10 20:12   ` Eric Blake
2017-05-10 20:23     ` Philippe Mathieu-Daudé
2017-05-10 20:19   ` Richard Henderson
2017-05-10 20:23     ` Eric Blake
2017-05-10 21:27     ` Philippe Mathieu-Daudé
2017-05-10 23:52     ` [Qemu-devel] [RFC PATCH v2] " Philippe Mathieu-Daudé
2017-05-11  0:13       ` Philippe Mathieu-Daudé
2017-05-11  9:03         ` Markus Armbruster
2017-05-12  2:01           ` Philippe Mathieu-Daudé
2017-05-12  2:04             ` Philippe Mathieu-Daudé
2017-05-15  7:04             ` Markus Armbruster
2017-05-10 20:05 ` [Qemu-devel] [PATCH 2/8] target/arm: optimize smul_dual() and neon_trn_u8() using extract op Philippe Mathieu-Daudé
2017-05-10 20:15   ` Eric Blake
2017-05-12  2:49     ` Philippe Mathieu-Daudé
2017-05-10 20:20   ` Richard Henderson
2017-05-10 20:32     ` Philippe Mathieu-Daudé
2017-05-12  1:31       ` Philippe Mathieu-Daudé
2017-05-10 20:05 ` [Qemu-devel] [PATCH 3/8] target/arm: optimize rev16() " Philippe Mathieu-Daudé
2017-05-12  1:54   ` Philippe Mathieu-Daudé
2017-05-10 20:05 ` [Qemu-devel] [PATCH 4/8] target/cris: optimize gen_swapb() " Philippe Mathieu-Daudé
2017-05-12  1:29   ` Philippe Mathieu-Daudé
2017-05-10 20:05 ` [Qemu-devel] [PATCH 5/8] target/m68k: optimize bcd_flags() " Philippe Mathieu-Daudé
2017-05-11  8:41   ` Laurent Vivier
2017-05-12  1:52     ` Philippe Mathieu-Daudé
2017-05-10 20:05 ` [Qemu-devel] [PATCH 6/8] target/mips: optimize bshfl() " Philippe Mathieu-Daudé
2017-05-12  2:13   ` Philippe Mathieu-Daudé
2017-05-10 20:05 ` [Qemu-devel] [PATCH 7/8] target/ppc: optimize various functions " Philippe Mathieu-Daudé
2017-05-11  0:41   ` David Gibson [this message]
2017-05-11  8:46     ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2017-05-12  5:13       ` David Gibson
2017-05-11  4:54   ` [Qemu-devel] " Nikunj A Dadhania
2017-05-12  1:48     ` Philippe Mathieu-Daudé
2017-05-12  5:16       ` David Gibson
2017-05-10 20:05 ` [Qemu-devel] [PATCH 8/8] target/sparc: " Philippe Mathieu-Daudé
2017-05-12  1:50   ` Philippe Mathieu-Daudé
2017-05-10 20:20 ` [Qemu-devel] [PATCH 0/8] optimize various tcg_gen() " no-reply
2017-05-12  2:34   ` Philippe Mathieu-Daudé

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=20170511004159.GD14408@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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).