1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mavx512bitalg -mavx512bw -mavx512vl" } */
3 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)"  1 } } */
4 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)"  1 } } */
5 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)"  1 } } */
6 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)"  1 } } */
7 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)"  1 } } */
8 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)"  1 } } */
9 
10 #include <x86intrin.h>
11 
12 extern __m256i y, y_1;
13 extern __m128i x, x_1;
14 
foo()15 int foo ()
16 {
17   __mmask16 msk16;
18   __mmask8 msk8;
19   __m256i c256 = _mm256_popcnt_epi16 (y);
20   asm volatile ("" : "+v" (c256));
21   c256 = _mm256_mask_popcnt_epi16 (y_1, msk16, y);
22   asm volatile ("" : "+v" (c256));
23   c256 = _mm256_maskz_popcnt_epi16 (msk16, y);
24   asm volatile ("" : "+v" (c256));
25   __m128i c128 = _mm_popcnt_epi16 (x);
26   asm volatile ("" : "+v" (c128));
27   c128 = _mm_mask_popcnt_epi16 (x_1, msk8, x);
28   asm volatile ("" : "+v" (c128));
29   c128 = _mm_maskz_popcnt_epi16 (msk8, x);
30   asm volatile ("" : "+v" (c128));
31 }
32