All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Cc: qemu-ppc@nongnu.org, rth@twiddle.net, qemu-devel@nongnu.org,
	bharata@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com,
	benh@kernel.crashing.org,
	Sandipan Das <sandipandas1990@gmail.com>
Subject: Re: [Qemu-devel] [PATCH RFC v0 2/6] target-ppc: add vabsdu[b, h, w] instructions
Date: Wed, 27 Jul 2016 15:52:58 +1000	[thread overview]
Message-ID: <20160727055258.GH17429@voom.fritz.box> (raw)
In-Reply-To: <1469561218-3067-3-git-send-email-nikunj@linux.vnet.ibm.com>

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

On Wed, Jul 27, 2016 at 12:56:54AM +0530, Nikunj A Dadhania wrote:
> From: Sandipan Das <sandipandas1990@gmail.com>
> 
> Adds following instructions:
> 
> vabsdub: Vector Absolute Difference Unsigned Byte
> vabsduh: Vector Absolute Difference Unsigned Halfword
> vabsduw: Vector Absolute Difference Unsigned Word
> 
> Signed-off-by: Sandipan Das <sandipandas1990@gmail.com>
> [ use ISA300 define and abs() ]
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> ---
>  target-ppc/helper.h     |  3 +++
>  target-ppc/int_helper.c | 23 +++++++++++++++++++++++
>  target-ppc/translate.c  | 15 ++++++++++++---
>  3 files changed, 38 insertions(+), 3 deletions(-)
> 
> diff --git a/target-ppc/helper.h b/target-ppc/helper.h
> index 68fd19e..ff6287e 100644
> --- a/target-ppc/helper.h
> +++ b/target-ppc/helper.h
> @@ -118,6 +118,9 @@ DEF_HELPER_3(vsubudm, void, avr, avr, avr)
>  DEF_HELPER_3(vavgub, void, avr, avr, avr)
>  DEF_HELPER_3(vavguh, void, avr, avr, avr)
>  DEF_HELPER_3(vavguw, void, avr, avr, avr)
> +DEF_HELPER_3(vabsdub, void, avr, avr, avr)
> +DEF_HELPER_3(vabsduh, void, avr, avr, avr)
> +DEF_HELPER_3(vabsduw, void, avr, avr, avr)
>  DEF_HELPER_3(vavgsb, void, avr, avr, avr)
>  DEF_HELPER_3(vavgsh, void, avr, avr, avr)
>  DEF_HELPER_3(vavgsw, void, avr, avr, avr)
> diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
> index 15947ad..c1b341c 100644
> --- a/target-ppc/int_helper.c
> +++ b/target-ppc/int_helper.c
> @@ -629,6 +629,29 @@ VAVG(w, s32, int64_t, u32, uint64_t)
>  #undef VAVG_DO
>  #undef VAVG
>  
> +#define VABSDU_DO(name, element, etype)                                 \

You don't appear to actually use the type parameter.

> +void helper_v##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b)           \
> +{                                                                       \
> +    int i;                                                              \
> +                                                                        \
> +    for (i = 0; i < ARRAY_SIZE(r->element); i++) {                      \
> +        r->element[i] = abs(a->element[i] - b->element[i]);             \
> +    }                                                                   \
> +}
> +
> +/* VABSDU - Vector absolute difference unsigned
> + *   name    - instruction mnemonic suffix (b: byte, h: halfword, w: word)
> + *   element - element type to access from vector
> + *   etype   - internal data type to use for elements
> + */
> +#define VABSDU(type, element, etype)                                    \
> +    VABSDU_DO(absdu##type, element, etype)
> +VABSDU(b, u8, uint16_t)
> +VABSDU(h, u16, uint32_t)
> +VABSDU(w, u32, uint64_t)
> +#undef VABSDU_DO
> +#undef VABSDU
> +
>  #define VCF(suffix, cvt, element)                                       \
>      void helper_vcf##suffix(CPUPPCState *env, ppc_avr_t *r,             \
>                              ppc_avr_t *b, uint32_t uim)                 \
> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
> index 23ef538..b18e13f 100644
> --- a/target-ppc/translate.c
> +++ b/target-ppc/translate.c
> @@ -7373,8 +7373,17 @@ GEN_VXFORM(vminsh, 1, 13);
>  GEN_VXFORM(vminsw, 1, 14);
>  GEN_VXFORM(vminsd, 1, 15);
>  GEN_VXFORM(vavgub, 1, 16);
> +GEN_VXFORM(vabsdub, 1, 16);
> +GEN_VXFORM_DUAL(vavgub, PPC_ALTIVEC, PPC_NONE, \
> +                vabsdub, PPC_NONE, PPC2_ISA300)
>  GEN_VXFORM(vavguh, 1, 17);
> +GEN_VXFORM(vabsduh, 1, 17);
> +GEN_VXFORM_DUAL(vavguh, PPC_ALTIVEC, PPC_NONE, \
> +                vabsduh, PPC_NONE, PPC2_ISA300)
>  GEN_VXFORM(vavguw, 1, 18);
> +GEN_VXFORM(vabsduw, 1, 18);
> +GEN_VXFORM_DUAL(vavguw, PPC_ALTIVEC, PPC_NONE, \
> +                vabsduw, PPC_NONE, PPC2_ISA300)
>  GEN_VXFORM(vavgsb, 1, 20);
>  GEN_VXFORM(vavgsh, 1, 21);
>  GEN_VXFORM(vavgsw, 1, 22);
> @@ -10890,9 +10899,9 @@ GEN_VXFORM(vminsb, 1, 12),
>  GEN_VXFORM(vminsh, 1, 13),
>  GEN_VXFORM(vminsw, 1, 14),
>  GEN_VXFORM_207(vminsd, 1, 15),
> -GEN_VXFORM(vavgub, 1, 16),
> -GEN_VXFORM(vavguh, 1, 17),
> -GEN_VXFORM(vavguw, 1, 18),
> +GEN_VXFORM_DUAL(vavgub, vabsdub, 1, 16, PPC_ALTIVEC, PPC_NONE),
> +GEN_VXFORM_DUAL(vavguh, vabsduh, 1, 17, PPC_ALTIVEC, PPC_NONE),
> +GEN_VXFORM_DUAL(vavguw, vabsduw, 1, 18, PPC_ALTIVEC, PPC_NONE),
>  GEN_VXFORM(vavgsb, 1, 20),
>  GEN_VXFORM(vavgsh, 1, 21),
>  GEN_VXFORM(vavgsw, 1, 22),

-- 
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:[~2016-07-27  6:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26 19:26 [Qemu-devel] [PATCH RFC v0 0/6] POWER9 TCG enablements - part2 Nikunj A Dadhania
2016-07-26 19:26 ` [Qemu-devel] [PATCH RFC v0 1/6] target-ppc: add dtstsfi[q] instructions Nikunj A Dadhania
2016-07-27  5:42   ` David Gibson
2016-07-26 19:26 ` [Qemu-devel] [PATCH RFC v0 2/6] target-ppc: add vabsdu[b, h, w] instructions Nikunj A Dadhania
2016-07-27  5:52   ` David Gibson [this message]
2016-07-27  6:19     ` Nikunj A Dadhania
2016-07-26 19:26 ` [Qemu-devel] [PATCH RFC v0 3/6] target-ppc: add vcmpnez[b, h, w][.] instructions Nikunj A Dadhania
2016-07-27  5:57   ` David Gibson
2016-07-27  6:22     ` Nikunj A Dadhania
2016-07-26 19:26 ` [Qemu-devel] [PATCH RFC v0 4/6] target-ppc: add vslv instruction Nikunj A Dadhania
2016-07-27  6:03   ` David Gibson
2016-07-26 19:26 ` [Qemu-devel] [PATCH RFC v0 5/6] target-ppc: add vsrv instruction Nikunj A Dadhania
2016-07-27  6:05   ` David Gibson
2016-07-27  6:31     ` Nikunj A Dadhania
2016-07-27  6:48       ` David Gibson
2016-07-27  6:57         ` Nikunj A Dadhania
2016-07-27  7:02           ` David Gibson
2016-07-26 19:26 ` [Qemu-devel] [PATCH RFC v0 6/6] target-ppc: add extswsli[.] instruction Nikunj A Dadhania
2016-07-27  6:07   ` David Gibson
2016-07-28  4:33 ` [Qemu-devel] [PATCH RFC v0 0/6] POWER9 TCG enablements - part2 David Gibson
2016-07-28  6:06   ` Nikunj A Dadhania

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=20160727055258.GH17429@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sandipandas1990@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.