qemu-e2k/target
Peter Maydell 18cf951af9 target/arm: Fix short-vector increment behaviour
For VFP short vectors, the VFP registers are divided into a
series of banks: for single-precision these are s0-s7, s8-s15,
s16-s23 and s24-s31; for double-precision they are d0-d3,
d4-d7, ... d28-d31. Some banks are "scalar" meaning that
use of a register within them triggers a pure-scalar or
mixed vector-scalar operation rather than a full vector
operation. The scalar banks are s0-s7, d0-d3 and d16-d19.
When using a bank as part of a vector operation, we
iterate through it, increasing the register number by
the specified stride each time, and wrapping around to
the beginning of the bank.

Unfortunately our calculation of the "increment" part of this
was incorrect:
 vd = ((vd + delta_d) & (bank_mask - 1)) | (vd & bank_mask)
will only do the intended thing if bank_mask has exactly
one set high bit. For instance for doubles (bank_mask = 0xc),
if we start with vd = 6 and delta_d = 2 then vd is updated
to 12 rather than the intended 4.

This only causes problems in the unlikely case that the
starting register is not the first in its bank: if the
register number doesn't have to wrap around then the
expression happens to give the right answer.

Fix this bug by abstracting out the "check whether register
is in a scalar bank" and "advance register within bank"
operations to utility functions which use the right
bit masking operations.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2019-06-13 15:14:06 +01:00
..
alpha Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
arm target/arm: Fix short-vector increment behaviour 2019-06-13 15:14:06 +01:00
cris Supply missing header guards 2019-06-12 13:20:21 +02:00
hppa Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
i386 Miscellaneous patches for 2019-06-11 2019-06-12 13:50:02 +01:00
lm32 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
m68k Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
microblaze Supply missing header guards 2019-06-12 13:20:21 +02:00
mips Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
moxie Supply missing header guards 2019-06-12 13:20:21 +02:00
nios2 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
openrisc Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
ppc ppc patch queue 2019-06-12 2019-06-12 14:43:47 +01:00
riscv Supply missing header guards 2019-06-12 13:20:21 +02:00
s390x Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
sh4 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
sparc Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
tilegx Normalize position of header guard 2019-06-12 13:20:20 +02:00
tricore Supply missing header guards 2019-06-12 13:20:21 +02:00
unicore32 Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
xtensa Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00