qemu/tcg
Peter Maydell 35e5688153 tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc()
In simd_desc() we create a SIMD descriptor from various pieces
including an arbitrary data value from the caller.  We try to
sanitize these to make sure everything will fit: the 'data' value
needs to fit in the SIMD_DATA_BITS (== 22) sized field.  However we
do that sanitizing with:
   tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS));

This works for the case where the data is supposed to be considered
as a signed integer (which can then be returned via simd_data()).
However, some callers want to treat the data value as unsigned.

Specifically, for the Arm SVE operations, make_svemte_desc()
assembles a data value as a collection of fields, and it needs to use
all 22 bits.  Currently if MTE is enabled then its MTEDESC SIZEM1
field may have the most significant bit set, and then it will trip
this assertion.

Loosen the assertion so that we only check that the data value will
fit into the field in some way, either as a signed or as an unsigned
value.  This means we will fail to detect some kinds of bug in the
callers, but we won't spuriously assert for intentional use of the
data field as unsigned.

Cc: qemu-stable@nongnu.org
Fixes: db432672dc ("tcg: Add generic vector expanders")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2601
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20241115172515.1229393-1-peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 8377e3fb85)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-11-18 19:29:40 +03:00
..
aarch64 tcg/aarch64: Support TCG_TARGET_HAS_tst_vec 2024-05-22 19:05:25 -07:00
arm tcg/arm: Support TCG_TARGET_HAS_tst_vec 2024-05-22 19:05:26 -07:00
i386 Revert "host/i386: assume presence of POPCNT" 2024-06-28 14:44:51 +02:00
loongarch64 tcg/loongarch64: Fix tcg_out_movi vs some pcrel pointers 2024-06-19 13:50:22 -07:00
mips tcg: Add TCGConst argument to tcg_target_const_match 2024-02-03 23:53:48 +00:00
ppc tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr 2024-10-10 21:03:38 +03:00
riscv util/cpuinfo-riscv: Support host/cpuinfo.h for riscv 2024-07-03 10:24:12 -07:00
s390x tcg/s390x: fix constraint for 32-bit TSTEQ/TSTNE 2024-10-18 17:42:11 +03:00
sparc64 tcg/sparc64: Support TCG_COND_TST{EQ,NE} 2024-02-03 23:53:49 +00:00
tci tcg/tci: Support TCG_COND_TST{EQ,NE} 2024-02-05 22:45:41 +00:00
debuginfo.c accel/tcg: Move perf and debuginfo support to tcg/ 2024-01-29 21:04:10 +10:00
meson.build meson: Drop the .fa library suffix 2024-07-03 18:41:26 +02:00
optimize.c tcg/optimize: Fix TCG_COND_TST* simplification of setcond2 2024-07-03 10:24:12 -07:00
perf.c accel/tcg: Move perf and debuginfo support to tcg/ 2024-01-29 21:04:10 +10:00
region.c tcg: Make the cleanup-on-error path unique 2024-01-23 13:22:46 +10:00
tcg-common.c tcg: Silent -Wmissing-field-initializers warning 2023-02-27 22:29:01 +01:00
tcg-internal.h tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported 2024-02-03 23:43:50 +00:00
tcg-ldst.c.inc tcg: Move TCGLabelQemuLdst to tcg.c 2023-05-05 17:21:03 +01:00
tcg-op-gvec.c tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc() 2024-11-18 19:29:40 +03:00
tcg-op-ldst.c plugins: Use emit_before_op for PLUGIN_GEN_FROM_MEM 2024-04-30 16:12:05 -07:00
tcg-op-vec.c tcg: Expand TCG_COND_TST* if not TCG_TARGET_HAS_tst_vec 2024-05-22 19:05:25 -07:00
tcg-op.c tcg: Remove INDEX_op_plugin_cb_{start,end} 2024-04-30 16:12:05 -07:00
tcg-pool.c.inc tcg: Introduce tcg_splitwx_to_{rx,rw} 2021-01-07 05:09:41 -10:00
tcg.c tcg: Reset data_gen_ptr correctly 2024-10-25 16:31:13 +03:00
tci.c tcg: Make tcg/helper-info.h self-contained 2024-04-30 16:12:05 -07:00