From: David Gibson <david@gibson.dropbear.id.au>
To: Richard Henderson <rth@twiddle.net>
Cc: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>,
qemu-ppc@nongnu.org, 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 v1 4/8] target-ppc: add vabsdu[b, h, w] instructions
Date: Fri, 29 Jul 2016 13:46:41 +1000 [thread overview]
Message-ID: <20160729034641.GJ2588@voom.fritz.box> (raw)
In-Reply-To: <900e59b4-16f6-25ef-ab82-c33f9fcedcd3@twiddle.net>
[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]
On Thu, Jul 28, 2016 at 06:22:05PM +0530, Richard Henderson wrote:
> On 07/28/2016 12:19 PM, Nikunj A Dadhania wrote:
> > + 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
> > + */
> > +#define VABSDU(type, element) \
> > + VABSDU_DO(absdu##type, element)
> > +VABSDU(b, u8)
> > +VABSDU(h, u16)
> > +VABSDU(w, u32)
>
> From whence are you receiving this abs definition, and how do you expect it
> to work with an unsigned input?
>
> I can only imagine you're getting abs(3), aka int abs(int), from stdlib.h.
> Which technically does work post-arithmetic promotion for u8 and u16, but it
> does not for u32.
So, I noticed this and was also concerned, but I more or less
convinced myself that it would still work, by the magic of 2's
complement, as long as sizeof(int) >= 4.
Maybe I'm wrong, though.
> I think we'd prefer an explicit (a > b ? a - b : b - a).
That probably is easier to follow, though.
--
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 --]
next prev parent reply other threads:[~2016-07-29 4:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-28 6:49 [Qemu-devel] [PATCH v1 0/8] POWER9 TCG enablements - part2 Nikunj A Dadhania
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 1/8] target-ppc: implement branch-less divw[o][.] Nikunj A Dadhania
2016-07-28 12:44 ` Richard Henderson
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 2/8] target-ppc: implement branch-less divd[o][.] Nikunj A Dadhania
2016-07-28 12:45 ` Richard Henderson
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 3/8] target-ppc: add dtstsfi[q] instructions Nikunj A Dadhania
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 4/8] target-ppc: add vabsdu[b, h, w] instructions Nikunj A Dadhania
2016-07-28 12:52 ` Richard Henderson
2016-07-28 17:21 ` Nikunj A Dadhania
2016-07-29 3:46 ` David Gibson [this message]
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 5/8] target-ppc: add vcmpnez[b, h, w][.] instructions Nikunj A Dadhania
2016-07-28 12:55 ` Richard Henderson
2016-07-28 17:31 ` Nikunj A Dadhania
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 6/8] target-ppc: add vslv instruction Nikunj A Dadhania
2016-07-28 13:00 ` Richard Henderson
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 7/8] target-ppc: add vsrv instruction Nikunj A Dadhania
2016-07-28 13:01 ` Richard Henderson
2016-07-28 6:49 ` [Qemu-devel] [PATCH v1 8/8] target-ppc: add extswsli[.] instruction Nikunj A Dadhania
2016-07-28 13:04 ` Richard Henderson
2016-07-28 17:33 ` Nikunj A Dadhania
[not found] <579ada3d.8625620a.cd2a2.f04b@mx.google.com>
2016-07-29 4:56 ` [Qemu-devel] [PATCH v1 4/8] target-ppc: add vabsdu[b, h, w] instructions David Gibson
2016-07-29 12:39 ` Richard Henderson
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=20160729034641.GJ2588@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 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).