2 /* { dg-options "-O2 -mavx512f -mavx512bw -mavx512vbmi2" } */
3 /* { dg-require-effective-target avx512f } */
4 /* { dg-require-effective-target avx512vbmi2 } */
9 #include "avx512f-helper.h"
11 #define SIZE (AVX512F_LEN / 16)
12 #include "avx512f-mask-type.h"
13 #include <x86intrin.h>
16 CALC (short *s
, short *r
, MASK_TYPE mask
)
20 for (i
= 0, k
= 0; i
< SIZE
; i
++)
22 if (mask
& ((long long)1 << i
))
30 UNION_TYPE (AVX512F_LEN
, i_w
) s
, res1
, res2
;
32 MASK_TYPE compressed_mask
, mask
= MASK_VALUE
;
34 int i
, mask_bit_count
, sign
= 1;
36 for (i
= 0; i
< SIZE
; i
++)
38 s
.a
[i
] = 12345 * (i
+ 200) * sign
;
39 res1
.a
[i
] = DEFAULT_VALUE
;
40 res3
[i
] = DEFAULT_VALUE
;
44 res1
.x
= INTRINSIC (_mask_compress_epi16
) (res1
.x
, mask
, s
.x
);
45 res2
.x
= INTRINSIC (_maskz_compress_epi16
) (mask
, s
.x
);
46 INTRINSIC (_mask_compressstoreu_epi16
) (res3
, mask
, s
.x
);
48 mask_bit_count
= __popcntd (mask
);
49 compressed_mask
= ((long long)1 << mask_bit_count
) - 1;
50 CALC (s
.a
, res_ref
, mask
);
52 MASK_MERGE (i_w
) (res_ref
, compressed_mask
, SIZE
);
54 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res1
, res_ref
))
57 MASK_ZERO (i_w
) (res_ref
, compressed_mask
, SIZE
);
58 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res2
, res_ref
))
61 MASK_MERGE (i_w
) (res_ref
, compressed_mask
, SIZE
);
62 if (checkVs (res3
, res_ref
, SIZE
))