@samitouri / QOSamiQemu / commits / e1288ec8d5

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 <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260618040718.572950-9-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Richard Henderson committed Jun 17, 2026 at 21:07 UTC e1288ec8d5c5d6e95a1eebcd52dd02eff44586a2
1 file changed +38 -5
target/arm/tcg/sve_helper.c
+38 -5
@@ -917,12 +917,45 @@ DO_ZPZ(sve_ah_fneg_h, uint16_t, H1_2, DO_AH_FNEG_H)
917 DO_ZPZ(sve_ah_fneg_s, uint32_t, H1_4, DO_AH_FNEG_S)
918 DO_ZPZ_D(sve_ah_fneg_d, uint64_t, DO_AH_FNEG_D)
919
920 -#define DO_NOT(N) (~N)
920 +static inline void
921 +sve_not_zpz(uint64_t *d, uint64_t *n, uint8_t *pg, uint32_t desc,
922 + uint64_t (*expand)(uint8_t))
923 +{
924 + intptr_t opr_sz = simd_oprsz(desc) / 8;
925 + bool zeroing = simd_data(desc) & 1;
926 +
927 + if (zeroing) {
928 + for (intptr_t i = 0; i < opr_sz; ++i) {
929 + uint64_t p = expand(pg[H1(i)]);
930 + d[i] = ~n[i] & p;
931 + }
932 + } else {
933 + for (intptr_t i = 0; i < opr_sz; ++i) {
934 + uint64_t p = expand(pg[H1(i)]);
935 + d[i] = (~n[i] & p) | (d[i] & ~p);
936 + }
937 + }
938 +}
939 +
940 +void HELPER(sve_not_zpz_b)(void *vd, void *vn, void *pg, uint32_t desc)
941 +{
942 + sve_not_zpz(vd, vn, pg, desc, expand_pred_b);
943 +}
944 +
945 +void HELPER(sve_not_zpz_h)(void *vd, void *vn, void *pg, uint32_t desc)
946 +{
947 + sve_not_zpz(vd, vn, pg, desc, expand_pred_h);
948 +}
949
922 -DO_ZPZ(sve_not_zpz_b, uint8_t, H1, DO_NOT)
923 -DO_ZPZ(sve_not_zpz_h, uint16_t, H1_2, DO_NOT)
924 -DO_ZPZ(sve_not_zpz_s, uint32_t, H1_4, DO_NOT)
925 -DO_ZPZ_D(sve_not_zpz_d, uint64_t, DO_NOT)
950 +void HELPER(sve_not_zpz_s)(void *vd, void *vn, void *pg, uint32_t desc)
951 +{
952 + sve_not_zpz(vd, vn, pg, desc, expand_pred_s);
953 +}
954 +
955 +void HELPER(sve_not_zpz_d)(void *vd, void *vn, void *pg, uint32_t desc)
956 +{
957 + sve_not_zpz(vd, vn, pg, desc, expand_pred_d);
958 +}
959
960 #define DO_SXTB(N) ((int8_t)N)
961 #define DO_SXTH(N) ((int16_t)N)