1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mavx512vpopcntdq -mavx512vl" } */
3 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)"  1 } } */
4 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)"  1 } } */
5 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)"  1 } } */
6 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)"  1 } } */
7 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)"  1 } } */
8 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)"  1 } } */
9 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)"  1 } } */
10 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)"  1 } } */
11 /* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)"  1 } } */
12 
13 #include <x86intrin.h>
14 
15 extern __m128i x, x_1;
16 extern __m256i y, y_1;
17 extern __m512i z, z_1;
18 
foo()19 int foo ()
20 {
21   __mmask16 msk;
22   __mmask8 msk8;
23   __m128i a = _mm_popcnt_epi32 (x);
24   asm volatile ("" : "+v" (a));
25   a = _mm_mask_popcnt_epi32 (x_1, msk8, x);
26   asm volatile ("" : "+v" (a));
27   a = _mm_maskz_popcnt_epi32 (msk8, x);
28   asm volatile ("" : "+v" (a));
29   __m256i b = _mm256_popcnt_epi32 (y);
30   asm volatile ("" : "+v" (b));
31   b = _mm256_mask_popcnt_epi32 (y_1, msk8, y);
32   asm volatile ("" : "+v" (b));
33   b = _mm256_maskz_popcnt_epi32 (msk8, y);
34   asm volatile ("" : "+v" (b));
35   __m512i c = _mm512_popcnt_epi32 (z);
36   asm volatile ("" : "+v" (c));
37   c = _mm512_mask_popcnt_epi32 (z_1, msk, z);
38   asm volatile ("" : "+v" (c));
39   c = _mm512_maskz_popcnt_epi32 (msk, z);
40   asm volatile ("" : "+v" (c));
41 }
42