From: Richard Henderson Date: Thu, 18 Jun 2026 04:07:18 +0000 (-0700) Subject: target/arm: Use expand_pred_N for helper_sve_not_zpz_N X-Git-Tag: v11.1.0-rc0~36^2~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1288ec8d5c5d6e95a1eebcd52dd02eff44586a2;p=thirdparty%2Fqemu.git target/arm: Use expand_pred_N for helper_sve_not_zpz_N These is a bitwise operation; with expand_pred_N, we can always operate on uint64_t. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20260618040718.572950-9-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index b2875a559b..ac96b18784 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -917,12 +917,45 @@ DO_ZPZ(sve_ah_fneg_h, uint16_t, H1_2, DO_AH_FNEG_H) DO_ZPZ(sve_ah_fneg_s, uint32_t, H1_4, DO_AH_FNEG_S) DO_ZPZ_D(sve_ah_fneg_d, uint64_t, DO_AH_FNEG_D) -#define DO_NOT(N) (~N) +static inline void +sve_not_zpz(uint64_t *d, uint64_t *n, uint8_t *pg, uint32_t desc, + uint64_t (*expand)(uint8_t)) +{ + intptr_t opr_sz = simd_oprsz(desc) / 8; + bool zeroing = simd_data(desc) & 1; + + if (zeroing) { + for (intptr_t i = 0; i < opr_sz; ++i) { + uint64_t p = expand(pg[H1(i)]); + d[i] = ~n[i] & p; + } + } else { + for (intptr_t i = 0; i < opr_sz; ++i) { + uint64_t p = expand(pg[H1(i)]); + d[i] = (~n[i] & p) | (d[i] & ~p); + } + } +} + +void HELPER(sve_not_zpz_b)(void *vd, void *vn, void *pg, uint32_t desc) +{ + sve_not_zpz(vd, vn, pg, desc, expand_pred_b); +} + +void HELPER(sve_not_zpz_h)(void *vd, void *vn, void *pg, uint32_t desc) +{ + sve_not_zpz(vd, vn, pg, desc, expand_pred_h); +} -DO_ZPZ(sve_not_zpz_b, uint8_t, H1, DO_NOT) -DO_ZPZ(sve_not_zpz_h, uint16_t, H1_2, DO_NOT) -DO_ZPZ(sve_not_zpz_s, uint32_t, H1_4, DO_NOT) -DO_ZPZ_D(sve_not_zpz_d, uint64_t, DO_NOT) +void HELPER(sve_not_zpz_s)(void *vd, void *vn, void *pg, uint32_t desc) +{ + sve_not_zpz(vd, vn, pg, desc, expand_pred_s); +} + +void HELPER(sve_not_zpz_d)(void *vd, void *vn, void *pg, uint32_t desc) +{ + sve_not_zpz(vd, vn, pg, desc, expand_pred_d); +} #define DO_SXTB(N) ((int8_t)N) #define DO_SXTH(N) ((int16_t)N)