qemu/target
Peter Maydell e6b2fa1b81 target/arm: Fix SVE SDOT/UDOT/USDOT (4-way, indexed)
Our implementation of the indexed version of SVE SDOT/UDOT/USDOT got
the calculation of the inner loop terminator wrong.  Although we
correctly account for the element size when we calculate the
terminator for the first iteration:
   intptr_t segend = MIN(16 / sizeof(TYPED), opr_sz_n);
we don't do that when we move it forward after the first inner loop
completes.  The intention is that we process the vector in 128-bit
segments, which for a 64-bit element size should mean (1, 2), (3, 4),
(5, 6), etc.  This bug meant that we would iterate (1, 2), (3, 4, 5,
6), (7, 8, 9, 10) etc and apply the wrong indexed element to some of
the operations, and also index off the end of the vector.

You don't see this bug if the vector length is small enough that we
don't need to iterate the outer loop, i.e.  if it is only 128 bits,
or if it is the 64-bit special case from AA32/AA64 AdvSIMD.  If the
vector length is 256 bits then we calculate the right results for the
elements in the vector but do index off the end of the vector. Vector
lengths greater than 256 bits see wrong answers. The instructions
that produce 32-bit results behave correctly.

Fix the recalculation of 'segend' for subsequent iterations, and
restore a version of the comment that was lost in the refactor of
commit 7020ffd656 that explains why we only need to clamp segend to
opr_sz_n for the first iteration, not the later ones.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2595
Fixes: 7020ffd656 ("target/arm: Macroize helper_gvec_{s,u}dot_idx_{b,h}")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20241101185544.2130972-1-peter.maydell@linaro.org
2024-11-05 10:09:58 +00:00
..
alpha target/alpha: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:56 +00:00
arm target/arm: Fix SVE SDOT/UDOT/USDOT (4-way, indexed) 2024-11-05 10:09:58 +00:00
avr target/avr: Use explicit little-endian LD/ST API 2024-10-15 12:13:59 -03:00
hexagon target/hexagon: Use explicit little-endian LD/ST API 2024-10-15 11:55:09 -03:00
hppa target/hppa: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:54 +00:00
i386 target/i386: Set 2-NaN propagation rule explicitly 2024-11-05 10:09:56 +00:00
loongarch target/loongarch: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:54 +00:00
m68k target/m68k: Initialize float_status fields in gdb set/get functions 2024-11-05 10:09:54 +00:00
microblaze target/microblaze: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:57 +00:00
mips target/mips: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:53 +00:00
openrisc target/openrisc: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:57 +00:00
ppc target/ppc: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:54 +00:00
riscv target/riscv: Fix vcompress with rvv_ta_all_1s 2024-10-31 13:51:24 +10:00
rx target/rx: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:57 +00:00
s390x target/s390x: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:54 +00:00
sh4 license: Update deprecated SPDX tag LGPL-2.0+ to LGPL-2.0-or-later 2024-09-20 10:11:59 +03:00
sparc target/sparc: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:55 +00:00
tricore target/tricore: Use tcg_constant_tl() instead of tcg_gen_movi_tl() 2024-10-15 12:13:59 -03:00
xtensa target/xtensa: Explicitly set 2-NaN propagation rule 2024-11-05 10:09:55 +00:00
Kconfig target/cris: Remove the deprecated CRIS target 2024-09-13 20:11:13 +02:00
meson.build target/cris: Remove the deprecated CRIS target 2024-09-13 20:11:13 +02:00