aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorAnton Blanchard <anton@ozlabs.org>2019-05-07 10:48:08 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2019-05-29 11:39:44 +1000
commit63be02fc69d44442dc7eb316d44f1c1fbe49c075 (patch)
tree5802df13ef7e8f2271c5e607791a96f280a7f13d /target
parentd47a751adab7833e9831408376077bc8dba41d5d (diff)
downloadqemu-63be02fc69d44442dc7eb316d44f1c1fbe49c075.zip
qemu-63be02fc69d44442dc7eb316d44f1c1fbe49c075.tar.gz
qemu-63be02fc69d44442dc7eb316d44f1c1fbe49c075.tar.bz2
target/ppc: Fix vslv and vsrv
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> Message-Id: <20190507004811.29968-6-anton@ozlabs.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target')
-rw-r--r--target/ppc/int_helper.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index 9af779a..2bad2d5 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -1815,10 +1815,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 */
}
}
@@ -1833,10 +1833,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 */
}
}