Re: [PATCH v2 2/5] powerpc/lib/sstep: Add popcnt instruction emulation

2017-07-24 Thread Matt Brown
On Mon, Jul 24, 2017 at 8:28 PM, Balbir Singh wrote: > On Mon, Jul 24, 2017 at 11:01 AM, Matt Brown > wrote: >> This adds emulations for the popcntb, popcntw, and popcntd instructions. >> Tested for correctness against the popcnt{b,w,d} instructions on ppc64le. >> >> Signed-off-by: Matt Brown >>

Re: [PATCH v2 2/5] powerpc/lib/sstep: Add popcnt instruction emulation

2017-07-24 Thread Balbir Singh
On Mon, Jul 24, 2017 at 11:01 AM, Matt Brown wrote: > This adds emulations for the popcntb, popcntw, and popcntd instructions. > Tested for correctness against the popcnt{b,w,d} instructions on ppc64le. > > Signed-off-by: Matt Brown > --- > v2: > - fixed opcodes > - fixed typecast

Re: [PATCH v2 2/5] powerpc/lib/sstep: Add popcnt instruction emulation

2017-07-24 Thread Segher Boessenkool
Hi Matt, On Mon, Jul 24, 2017 at 11:01:06AM +1000, Matt Brown wrote: > + for (i = 0; i < (64 / size); i++) { If you do for (i = 0; i < 64; i += size) things are slightly nicer. > + if ((i * size) < 32) > + low |= n << (i * size); > + else > +

[PATCH v2 2/5] powerpc/lib/sstep: Add popcnt instruction emulation

2017-07-23 Thread Matt Brown
This adds emulations for the popcntb, popcntw, and popcntd instructions. Tested for correctness against the popcnt{b,w,d} instructions on ppc64le. Signed-off-by: Matt Brown --- v2: - fixed opcodes - fixed typecasting - fixed bitshifting error for both 32 and 64bit arch ---