qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: matheus.ferst@eldorado.org.br, qemu-devel@nongnu.org,
	qemu-ppc@nongnu.org
Cc: Lucas Coutinho <lucas.coutinho@eldorado.org.br>,
	groug@kaod.org, danielhb413@gmail.com, clg@kaod.org,
	david@gibson.dropbear.id.au
Subject: Re: [PATCH v3 07/37] target/ppc: Move vexts[bhw]2[wd] to decodetree
Date: Fri, 11 Feb 2022 15:14:33 +1100	[thread overview]
Message-ID: <d6e854de-d675-a5e3-406c-b3b56e0b0a6d@linaro.org> (raw)
In-Reply-To: <20220210123447.3933301-8-matheus.ferst@eldorado.org.br>

On 2/10/22 23:34, matheus.ferst@eldorado.org.br wrote:
> From: Lucas Coutinho <lucas.coutinho@eldorado.org.br>
> 
> Move the following instructions to decodetree:
> vextsb2w: Vector Extend Sign Byte To Word
> vextsh2w: Vector Extend Sign Halfword To Word
> vextsb2d: Vector Extend Sign Byte To Doubleword
> vextsh2d: Vector Extend Sign Halfword To Doubleword
> vextsw2d: Vector Extend Sign Word To Doubleword
> 
> Signed-off-by: Lucas Coutinho <lucas.coutinho@eldorado.org.br>
> Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
> ---
>   target/ppc/helper.h                 |  5 -----
>   target/ppc/insn32.decode            |  8 ++++++++
>   target/ppc/int_helper.c             | 15 ---------------
>   target/ppc/translate/vmx-impl.c.inc | 25 ++++++++++++++++++++-----
>   target/ppc/translate/vmx-ops.c.inc  |  5 -----
>   5 files changed, 28 insertions(+), 30 deletions(-)
> 
> diff --git a/target/ppc/helper.h b/target/ppc/helper.h
> index 92595a42df..0084080fad 100644
> --- a/target/ppc/helper.h
> +++ b/target/ppc/helper.h
> @@ -249,11 +249,6 @@ DEF_HELPER_4(VINSBLX, void, env, avr, i64, tl)
>   DEF_HELPER_4(VINSHLX, void, env, avr, i64, tl)
>   DEF_HELPER_4(VINSWLX, void, env, avr, i64, tl)
>   DEF_HELPER_4(VINSDLX, void, env, avr, i64, tl)
> -DEF_HELPER_2(vextsb2w, void, avr, avr)
> -DEF_HELPER_2(vextsh2w, void, avr, avr)
> -DEF_HELPER_2(vextsb2d, void, avr, avr)
> -DEF_HELPER_2(vextsh2d, void, avr, avr)
> -DEF_HELPER_2(vextsw2d, void, avr, avr)
>   DEF_HELPER_2(vnegw, void, avr, avr)
>   DEF_HELPER_2(vnegd, void, avr, avr)
>   DEF_HELPER_2(vupkhpx, void, avr, avr)
> diff --git a/target/ppc/insn32.decode b/target/ppc/insn32.decode
> index c4796260b6..757791f0ac 100644
> --- a/target/ppc/insn32.decode
> +++ b/target/ppc/insn32.decode
> @@ -419,6 +419,14 @@ VINSWVRX        000100 ..... ..... ..... 00110001111    @VX
>   VSLDBI          000100 ..... ..... ..... 00 ... 010110  @VN
>   VSRDBI          000100 ..... ..... ..... 01 ... 010110  @VN
>   
> +## Vector Integer Arithmetic Instructions
> +
> +VEXTSB2W        000100 ..... 10000 ..... 11000000010    @VX_tb
> +VEXTSH2W        000100 ..... 10001 ..... 11000000010    @VX_tb
> +VEXTSB2D        000100 ..... 11000 ..... 11000000010    @VX_tb
> +VEXTSH2D        000100 ..... 11001 ..... 11000000010    @VX_tb
> +VEXTSW2D        000100 ..... 11010 ..... 11000000010    @VX_tb
> +
>   ## Vector Mask Manipulation Instructions
>   
>   MTVSRBM         000100 ..... 10000 ..... 11001000010    @VX_tb
> diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
> index 79cde68f19..630fbc579a 100644
> --- a/target/ppc/int_helper.c
> +++ b/target/ppc/int_helper.c
> @@ -1768,21 +1768,6 @@ XXBLEND(W, 32)
>   XXBLEND(D, 64)
>   #undef XXBLEND
>   
> -#define VEXT_SIGNED(name, element, cast)                            \
> -void helper_##name(ppc_avr_t *r, ppc_avr_t *b)                      \
> -{                                                                   \
> -    int i;                                                          \
> -    for (i = 0; i < ARRAY_SIZE(r->element); i++) {                  \
> -        r->element[i] = (cast)b->element[i];                        \
> -    }                                                               \
> -}
> -VEXT_SIGNED(vextsb2w, s32, int8_t)
> -VEXT_SIGNED(vextsb2d, s64, int8_t)
> -VEXT_SIGNED(vextsh2w, s32, int16_t)
> -VEXT_SIGNED(vextsh2d, s64, int16_t)
> -VEXT_SIGNED(vextsw2d, s64, int32_t)
> -#undef VEXT_SIGNED
> -
>   #define VNEG(name, element)                                         \
>   void helper_##name(ppc_avr_t *r, ppc_avr_t *b)                      \
>   {                                                                   \
> diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx-impl.c.inc
> index b7559cf94c..ec782c47ff 100644
> --- a/target/ppc/translate/vmx-impl.c.inc
> +++ b/target/ppc/translate/vmx-impl.c.inc
> @@ -1772,11 +1772,26 @@ GEN_VXFORM_TRANS(vclzw, 1, 30)
>   GEN_VXFORM_TRANS(vclzd, 1, 31)
>   GEN_VXFORM_NOA_2(vnegw, 1, 24, 6)
>   GEN_VXFORM_NOA_2(vnegd, 1, 24, 7)
> -GEN_VXFORM_NOA_2(vextsb2w, 1, 24, 16)
> -GEN_VXFORM_NOA_2(vextsh2w, 1, 24, 17)
> -GEN_VXFORM_NOA_2(vextsb2d, 1, 24, 24)
> -GEN_VXFORM_NOA_2(vextsh2d, 1, 24, 25)
> -GEN_VXFORM_NOA_2(vextsw2d, 1, 24, 26)
> +
> +static bool do_vexts(DisasContext *ctx, arg_VX_tb *a, int vece, int s)
> +{
> +    REQUIRE_INSNS_FLAGS2(ctx, ISA300);
> +    REQUIRE_VECTOR(ctx);
> +
> +    tcg_gen_gvec_shli(vece, avr_full_offset(a->vrt), avr_full_offset(a->vrb),
> +                      s, 16, 16);
> +    tcg_gen_gvec_sari(vece, avr_full_offset(a->vrt), avr_full_offset(a->vrt),
> +                      s, 16, 16);

It would be better to collect this into a single composite gvec operation (x86 is 
especially bad with unsupported vector operation sizes).

Use GVecGen3, provide the relevant .fni4/.fni8/.fniv functions and the vecop_list.  We 
have elsewhere relied on 4 integer operations being expanded, when the vector op itself 
isn't supported, so you should be able to drop the .fnio out-of-line helper.


r~


  reply	other threads:[~2022-02-11  4:16 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 12:34 [PATCH v3 00/37] target/ppc: PowerISA Vector/VSX instruction batch matheus.ferst
2022-02-10 12:34 ` [PATCH v3 01/37] target/ppc: Introduce TRANS*FLAGS macros matheus.ferst
2022-02-10 12:34 ` [PATCH v3 02/37] target/ppc: moved vector even and odd multiplication to decodetree matheus.ferst
2022-02-11  3:39   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 03/37] target/ppc: Moved vector multiply high and low " matheus.ferst
2022-02-11  3:41   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 04/37] target/ppc: vmulh* instructions use gvec matheus.ferst
2022-02-11  3:51   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 05/37] target/ppc: Implement vmsumcud instruction matheus.ferst
2022-02-11  4:05   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 06/37] target/ppc: Implement vmsumudm instruction matheus.ferst
2022-02-11  4:07   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 07/37] target/ppc: Move vexts[bhw]2[wd] to decodetree matheus.ferst
2022-02-11  4:14   ` Richard Henderson [this message]
2022-02-10 12:34 ` [PATCH v3 08/37] target/ppc: Implement vextsd2q matheus.ferst
2022-02-11  4:15   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 09/37] target/ppc: Move Vector Compare Equal/Not Equal/Greater Than to decodetree matheus.ferst
2022-02-11  4:27   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 10/37] target/ppc: Move Vector Compare Not Equal or Zero " matheus.ferst
2022-02-11  4:41   ` Richard Henderson
2022-02-17 12:45     ` Matheus K. Ferst
2022-02-10 12:34 ` [PATCH v3 11/37] target/ppc: Implement Vector Compare Equal Quadword matheus.ferst
2022-02-11  4:51   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 12/37] target/ppc: Implement Vector Compare Greater Than Quadword matheus.ferst
2022-02-11  4:53   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 13/37] target/ppc: Implement Vector Compare Quadword matheus.ferst
2022-02-11  4:55   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 14/37] target/ppc: implement vstri[bh][lr] matheus.ferst
2022-02-11  5:00   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 15/37] target/ppc: implement vclrlb matheus.ferst
2022-02-11  5:20   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 16/37] target/ppc: implement vclrrb matheus.ferst
2022-02-10 12:34 ` [PATCH v3 17/37] target/ppc: implement vcntmb[bhwd] matheus.ferst
2022-02-11  5:28   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 18/37] target/ppc: implement vgnb matheus.ferst
2022-02-11  6:15   ` Richard Henderson
2022-02-10 12:34 ` [PATCH v3 19/37] target/ppc: Move vsel and vperm/vpermr to decodetree matheus.ferst
2022-02-10 12:34 ` [PATCH v3 20/37] target/ppc: Move xxsel " matheus.ferst
2022-02-10 12:34 ` [PATCH v3 21/37] target/ppc: move xxperm/xxpermr " matheus.ferst
2022-02-10 12:34 ` [PATCH v3 22/37] target/ppc: Move xxpermdi " matheus.ferst
2022-02-10 12:34 ` [PATCH v3 23/37] target/ppc: Implement xxpermx instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 24/37] tcg/tcg-op-gvec.c: Introduce tcg_gen_gvec_4i matheus.ferst
2022-02-10 12:34 ` [PATCH v3 25/37] target/ppc: Implement xxeval matheus.ferst
2022-02-10 12:34 ` [PATCH v3 26/37] target/ppc: Implement xxgenpcv[bhwd]m instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 27/37] target/ppc: move xs[n]madd[am][ds]p/xs[n]msub[am][ds]p to decodetree matheus.ferst
2022-02-10 12:34 ` [PATCH v3 28/37] target/ppc: implement xs[n]maddqp[o]/xs[n]msubqp[o] matheus.ferst
2022-02-10 12:34 ` [PATCH v3 29/37] target/ppc: Implement xvtlsbb instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 30/37] target/ppc: Remove xscmpnedp instruction matheus.ferst
2022-02-10 12:34 ` [PATCH v3 31/37] target/ppc: Refactor VSX_SCALAR_CMP_DP matheus.ferst
2022-02-10 12:34 ` [PATCH v3 32/37] target/ppc: Implement xscmp{eq,ge,gt}qp matheus.ferst
2022-02-10 12:34 ` [PATCH v3 33/37] target/ppc: Move xscmp{eq,ge,gt}dp to decodetree matheus.ferst
2022-02-10 12:34 ` [PATCH v3 34/37] target/ppc: Move xs{max, min}[cj]dp to use do_helper_XX3 matheus.ferst
2022-02-10 12:34 ` [PATCH v3 35/37] target/ppc: Refactor VSX_MAX_MINC helper matheus.ferst
2022-02-10 12:34 ` [PATCH v3 36/37] target/ppc: Implement xs{max,min}cqp matheus.ferst
2022-02-10 12:34 ` [PATCH v3 37/37] target/ppc: Implement xvcvbf16spn and xvcvspbf16 instructions matheus.ferst

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=d6e854de-d675-a5e3-406c-b3b56e0b0a6d@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=lucas.coutinho@eldorado.org.br \
    --cc=matheus.ferst@eldorado.org.br \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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).