qemu/target/arm
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
..
arch_dump.c target/arm: Add aa{32, 64}_vfp_{dreg, qreg} helpers 2018-01-25 11:45:29 +00:00
arm_ldst.h target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
arm-powerctl.c target/arm/arm-powerctl: Add new arm_set_cpu_on_and_reset() 2019-02-28 11:03:04 +00:00
arm-powerctl.h target/arm/arm-powerctl: Add new arm_set_cpu_on_and_reset() 2019-02-28 11:03:04 +00:00
arm-semi.c semihosting: split console_out into string and char versions 2019-06-12 17:53:22 +01:00
cpu64.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
cpu-param.h tcg: Split out target/arch/cpu-param.h 2019-06-10 07:03:34 -07:00
cpu-qom.h arm: replace instance_post_init() 2019-01-07 16:18:42 +04:00
cpu.c target/arm: Explicitly enable VFP short-vectors for aarch32 -cpu max 2019-06-13 15:14:03 +01:00
cpu.h target/arm: Convert VFP VMLA to decodetree 2019-06-13 15:14:04 +01:00
crypto_helper.c target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
gdbstub64.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
gdbstub.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
helper-a64.c target/arm: Use env_cpu, env_archcpu 2019-06-10 07:03:34 -07:00
helper-a64.h target/arm: Split helper_msr_i_pstate into 3 2019-03-05 15:55:08 +00:00
helper-sve.h target/arm: Rewrite vector gather first-fault loads 2018-10-08 14:55:03 +01:00
helper.c target/arm: Implement NSACR gating of floating point 2019-06-13 15:14:03 +01:00
helper.h target/arm: Use tcg_gen_abs_i64 and tcg_gen_gvec_abs 2019-05-13 22:52:08 +00:00
idau.h qom: make interface types abstract 2018-12-11 15:45:22 -02:00
internals.h target/arm: Convert to CPUClass::tlb_fill 2019-05-10 11:12:50 -07:00
iwmmxt_helper.c target/arm: Untabify iwmmxt_helper.c 2018-08-24 13:17:48 +01:00
kvm32.c arm: Remove unnecessary includes of hw/arm/arm.h 2019-05-23 14:47:43 +01:00
kvm64.c arm: Remove unnecessary includes of hw/arm/arm.h 2019-05-23 14:47:43 +01:00
kvm_arm.h kvm: add kvm_arm_get_max_vm_ipa_size 2019-03-05 15:55:09 +00:00
kvm-consts.h arm: add trailing ; after MISMATCH_CHECK 2017-02-01 03:37:18 +02:00
kvm-stub.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
kvm.c arm: Remove unnecessary includes of hw/arm/arm.h 2019-05-23 14:47:43 +01:00
machine.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
Makefile.objs target/arm: Add stubs for AArch32 VFP decodetree 2019-06-13 15:14:03 +01:00
monitor.c qapi: make query-gic-capabilities depend on TARGET_ARM 2019-02-18 14:44:05 +01:00
neon_helper.c target/arm: Use tcg_gen_abs_i64 and tcg_gen_gvec_abs 2019-05-13 22:52:08 +00:00
op_addsub.h Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
op_helper.c target/arm: Use env_cpu, env_archcpu 2019-06-10 07:03:34 -07:00
pauth_helper.c target/arm: Fix output of PAuth Auth 2019-06-13 15:14:03 +01:00
psci.c target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
sve_helper.c tcg: Use tlb_fill probe from tlb_vaddr_to_host 2019-05-10 11:12:50 -07:00
sve.decode target/arm: SVE brk[ab] merging does not have s bit 2019-01-07 15:23:45 +00:00
trace-events trace-events: Shorten file names in comments 2019-03-22 16:18:07 +00:00
translate-a64.c target/arm: Use tcg_gen_gvec_bitsel 2019-06-13 15:14:03 +01:00
translate-a64.h target/arm: Use tcg_gen_gvec_bitsel 2019-06-13 15:14:03 +01:00
translate-sve.c tcg: Specify optional vector requirements with a list 2019-05-13 14:44:03 -07:00
translate-vfp.inc.c target/arm: Fix short-vector increment behaviour 2019-06-13 15:14:06 +01:00
translate.c target/arm: Convert float-to-integer VCVT insns to decodetree 2019-06-13 15:14:06 +01:00
translate.h target/arm: Use tcg_gen_gvec_bitsel 2019-06-13 15:14:03 +01:00
vec_helper.c target/arm: Add helpers for FMLAL 2019-02-28 11:03:05 +00:00
vfp_helper.c target/arm: Use env_cpu, env_archcpu 2019-06-10 07:03:34 -07:00
vfp-uncond.decode target/arm: Convert VCVTA/VCVTN/VCVTP/VCVTM to decodetree 2019-06-13 15:14:04 +01:00
vfp.decode target/arm: Convert float-to-integer VCVT insns to decodetree 2019-06-13 15:14:06 +01:00