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)