From e7cec52fac0b02990ce52817c556fab46cc84df5 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 30 Mar 2021 14:32:42 -0400 Subject: [PATCH] target/arm: Fix sve_punpk_p vs odd vector lengths Wrote too much with punpk1 with vl % 512 != 0. Backports fd911a21414b5a17663fa2b97f1059fb11cee99d --- qemu/target/arm/sve_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/target/arm/sve_helper.c b/qemu/target/arm/sve_helper.c index fb93fc12..8d34b69e 100644 --- a/qemu/target/arm/sve_helper.c +++ b/qemu/target/arm/sve_helper.c @@ -2104,11 +2104,11 @@ void HELPER(sve_punpk_p)(void *vd, void *vn, uint32_t pred_desc) high = oprsz >> 1; } - if ((high & 3) == 0) { + if ((oprsz & 7) == 0) { uint32_t *n = vn; high >>= 2; - for (i = 0; i < DIV_ROUND_UP(oprsz, 8); i++) { + for (i = 0; i < oprsz / 8; i++) { uint64_t nn = n[H4(high + i)]; d[i] = expand_bits(nn, 0); }