Message ID | 20190507004811.29968-6-anton@ozlabs.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/9] target/ppc: Fix xvxsigdp | expand |
On Tue, May 07, 2019 at 10:48:08AM +1000, Anton Blanchard wrote: > vslv and vsrv are broken on little endian, we append 00 to the > high byte not the low byte. Fix it by using the VsrB() accessor. > > Signed-off-by: Anton Blanchard <anton@ozlabs.org> Applied, thanks. > --- > target/ppc/int_helper.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c > index f6a088ac08..fd715b4076 100644 > --- a/target/ppc/int_helper.c > +++ b/target/ppc/int_helper.c > @@ -1800,10 +1800,10 @@ void helper_vslv(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) > > size = ARRAY_SIZE(r->u8); > for (i = 0; i < size; i++) { > - shift = b->u8[i] & 0x7; /* extract shift value */ > - bytes = (a->u8[i] << 8) + /* extract adjacent bytes */ > - (((i + 1) < size) ? a->u8[i + 1] : 0); > - r->u8[i] = (bytes << shift) >> 8; /* shift and store result */ > + shift = b->VsrB(i) & 0x7; /* extract shift value */ > + bytes = (a->VsrB(i) << 8) + /* extract adjacent bytes */ > + (((i + 1) < size) ? a->VsrB(i + 1) : 0); > + r->VsrB(i) = (bytes << shift) >> 8; /* shift and store result */ > } > } > > @@ -1818,10 +1818,10 @@ void helper_vsrv(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) > * order will guarantee that computed result is not fed back. > */ > for (i = ARRAY_SIZE(r->u8) - 1; i >= 0; i--) { > - shift = b->u8[i] & 0x7; /* extract shift value */ > - bytes = ((i ? a->u8[i - 1] : 0) << 8) + a->u8[i]; > + shift = b->VsrB(i) & 0x7; /* extract shift value */ > + bytes = ((i ? a->VsrB(i - 1) : 0) << 8) + a->VsrB(i); > /* extract adjacent bytes */ > - r->u8[i] = (bytes >> shift) & 0xFF; /* shift and store result */ > + r->VsrB(i) = (bytes >> shift) & 0xFF; /* shift and store result */ > } > } >
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index f6a088ac08..fd715b4076 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1800,10 +1800,10 @@ void helper_vslv(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) size = ARRAY_SIZE(r->u8); for (i = 0; i < size; i++) { - shift = b->u8[i] & 0x7; /* extract shift value */ - bytes = (a->u8[i] << 8) + /* extract adjacent bytes */ - (((i + 1) < size) ? a->u8[i + 1] : 0); - r->u8[i] = (bytes << shift) >> 8; /* shift and store result */ + shift = b->VsrB(i) & 0x7; /* extract shift value */ + bytes = (a->VsrB(i) << 8) + /* extract adjacent bytes */ + (((i + 1) < size) ? a->VsrB(i + 1) : 0); + r->VsrB(i) = (bytes << shift) >> 8; /* shift and store result */ } } @@ -1818,10 +1818,10 @@ void helper_vsrv(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) * order will guarantee that computed result is not fed back. */ for (i = ARRAY_SIZE(r->u8) - 1; i >= 0; i--) { - shift = b->u8[i] & 0x7; /* extract shift value */ - bytes = ((i ? a->u8[i - 1] : 0) << 8) + a->u8[i]; + shift = b->VsrB(i) & 0x7; /* extract shift value */ + bytes = ((i ? a->VsrB(i - 1) : 0) << 8) + a->VsrB(i); /* extract adjacent bytes */ - r->u8[i] = (bytes >> shift) & 0xFF; /* shift and store result */ + r->VsrB(i) = (bytes >> shift) & 0xFF; /* shift and store result */ } }
vslv and vsrv are broken on little endian, we append 00 to the high byte not the low byte. Fix it by using the VsrB() accessor. Signed-off-by: Anton Blanchard <anton@ozlabs.org> --- target/ppc/int_helper.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)