1 /* { dg-do compile } */
2 /* { dg-options "-O2 -mavx512vpopcntdq -mavx512vl" } */
3 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
4 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
5 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
6 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
7 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
8 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
9 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
10 /* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
11 /* { dg-final { scan-assembler-times "vpopcntq\[ \\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 __mmask8 msk;
22 __m128i a = _mm_popcnt_epi64 (x);
23 asm volatile ("" : "+v" (a));
24 a = _mm_mask_popcnt_epi64 (x_1, msk, x);
25 asm volatile ("" : "+v" (a));
26 a = _mm_maskz_popcnt_epi64 (msk, x);
27 asm volatile ("" : "+v" (a));
28 __m256i b = _mm256_popcnt_epi64 (y);
29 asm volatile ("" : "+v" (b));
30 b = _mm256_mask_popcnt_epi64 (y_1, msk, y);
31 asm volatile ("" : "+v" (b));
32 b = _mm256_maskz_popcnt_epi64 (msk, y);
33 asm volatile ("" : "+v" (b));
34 __m512i c = _mm512_popcnt_epi64 (z);
35 asm volatile ("" : "+v" (c));
36 c = _mm512_mask_popcnt_epi64 (z_1, msk, z);
37 asm volatile ("" : "+v" (c));
38 c = _mm512_maskz_popcnt_epi64 (msk, z);
39 asm volatile ("" : "+v" (c));
40 }
41