Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions

2016-10-27 Thread David Gibson
On Thu, Oct 27, 2016 at 07:16:24AM -0700, Richard Henderson wrote: > On 10/27/2016 01:36 AM, Nikunj A Dadhania wrote: > > Right, it does reduce number of operations: > > > > +#define SIZE_MASK(x) ((1ULL << (x)) - 1) > > +static uint64_t vparity(uint64_t f1, uint64_t f2, int size) > > +{ > > +u

Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions

2016-10-27 Thread Richard Henderson
On 10/27/2016 01:36 AM, Nikunj A Dadhania wrote: Right, it does reduce number of operations: +#define SIZE_MASK(x) ((1ULL << (x)) - 1) +static uint64_t vparity(uint64_t f1, uint64_t f2, int size) +{ +uint64_t res = f1 ^ f2; +if (size == 8) return res; +return vparity(res & SIZE_MASK(

Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions

2016-10-27 Thread David Gibson
On Wed, Oct 26, 2016 at 10:22:10PM -0700, Richard Henderson wrote: > On 10/26/2016 08:47 PM, David Gibson wrote: > > > > +void helper_vprtybq(ppc_avr_t *r, ppc_avr_t *b) > > > > +{ > > > > +int i; > > > > +uint8_t s = 0; > > > > +for (i = 0; i < 16; i++) { > > > > +s ^= (b->u8[i

Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions

2016-10-27 Thread Nikunj A Dadhania
Richard Henderson writes: > On 10/26/2016 08:47 PM, David Gibson wrote: >>> > +void helper_vprtybq(ppc_avr_t *r, ppc_avr_t *b) >>> > +{ >>> > +int i; >>> > +uint8_t s = 0; >>> > +for (i = 0; i < 16; i++) { >>> > +s ^= (b->u8[i] & 1); >>> > +} >>> > +r->u64[LO_IDX] = (!

Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions

2016-10-26 Thread Richard Henderson
On 10/26/2016 08:47 PM, David Gibson wrote: > +void helper_vprtybq(ppc_avr_t *r, ppc_avr_t *b) > +{ > +int i; > +uint8_t s = 0; > +for (i = 0; i < 16; i++) { > +s ^= (b->u8[i] & 1); > +} > +r->u64[LO_IDX] = (!s) ? 0 : 1; > +r->u64[HI_IDX] = 0; > +} > + I think you

Re: [Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions

2016-10-26 Thread David Gibson
On Wed, Oct 26, 2016 at 11:56:28AM +0530, Nikunj A Dadhania wrote: > From: Ankit Kumar > > Add following POWER ISA 3.0 instructions. > vprtybw: Vector Parity Byte Word > vprtybd: Vector Parity Byte Double Word > vprtybq: Vector Parity Byte Quad Word > > Signed-off-by: Ankit Kumar > Signed-off-b

[Qemu-devel] [PATCH v2 5/6] target-ppc: add vprtyb[w/d/q] instructions

2016-10-25 Thread Nikunj A Dadhania
From: Ankit Kumar Add following POWER ISA 3.0 instructions. vprtybw: Vector Parity Byte Word vprtybd: Vector Parity Byte Double Word vprtybq: Vector Parity Byte Quad Word Signed-off-by: Ankit Kumar Signed-off-by: Nikunj A Dadhania --- target-ppc/helper.h | 3 +++ target-ppc/i