diff options
author | Matheus Ferst <matheus.ferst@eldorado.org.br> | 2022-06-01 09:53:55 -0300 |
---|---|---|
committer | Daniel Henrique Barboza <danielhb413@gmail.com> | 2022-06-20 08:38:58 -0300 |
commit | 8f7d41e0c9cdcb696df564100e77c81ef6a9d026 (patch) | |
tree | 495806f6454a7290755e07a8e2cbf2707a4f593f /target/ppc/int_helper.c | |
parent | 453eb94c7651e791c3cbc1bbf8880677a61342ca (diff) | |
download | qemu-8f7d41e0c9cdcb696df564100e77c81ef6a9d026.zip qemu-8f7d41e0c9cdcb696df564100e77c81ef6a9d026.tar.gz qemu-8f7d41e0c9cdcb696df564100e77c81ef6a9d026.tar.bz2 |
target/ppc: fix vbpermd in big endian hosts
The extract64 arguments are not endian dependent as they are only used
for bitwise operations. The current behavior in little-endian hosts is
correct; since the indexes in VRB are in PowerISA-ordering, we should
always invert the value before calling extract64. Also, using the VsrD
macro, we can have a single EXTRACT_BIT definition for big and
little-endian with the correct behavior.
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220601125355.1266165-1-matheus.ferst@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Diffstat (limited to 'target/ppc/int_helper.c')
-rw-r--r-- | target/ppc/int_helper.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c index 16357c0..1187194 100644 --- a/target/ppc/int_helper.c +++ b/target/ppc/int_helper.c @@ -1413,14 +1413,13 @@ XXGENPCV(XXGENPCVDM, 8) #define VBPERMQ_INDEX(avr, i) ((avr)->u8[(i)]) #define VBPERMD_INDEX(i) (i) #define VBPERMQ_DW(index) (((index) & 0x40) != 0) -#define EXTRACT_BIT(avr, i, index) (extract64((avr)->u64[i], index, 1)) #else #define VBPERMQ_INDEX(avr, i) ((avr)->u8[15 - (i)]) #define VBPERMD_INDEX(i) (1 - i) #define VBPERMQ_DW(index) (((index) & 0x40) == 0) -#define EXTRACT_BIT(avr, i, index) \ - (extract64((avr)->u64[1 - i], 63 - index, 1)) #endif +#define EXTRACT_BIT(avr, i, index) \ + (extract64((avr)->VsrD(i), 63 - index, 1)) void helper_vbpermd(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) { |