Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512bitalg-pr97770-1.c

raw
1 /* PR target/97770 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -march=icelake-server -mprefer-vector-width=512" } */
4 /* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */
5 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */
6 /* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */
7 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */
8 /* { dg-final { scan-assembler-times "vpopcntb\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */
9 /* { dg-final { scan-assembler-times "vpopcntw\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */
10
11 #include <immintrin.h>
12
13 void
14 __attribute__ ((noipa, optimize("-O3")))
15 popcountb_128 (unsigned char * __restrict dest, unsigned char* src)
16 {
17 for (int i = 0; i != 16; i++)
18 dest[i] = __builtin_popcount (src[i]);
19 }
20
21 void
22 __attribute__ ((noipa, optimize("-O3")))
23 popcountw_128 (unsigned short* __restrict dest, unsigned short* src)
24 {
25 for (int i = 0; i != 8; i++)
26 dest[i] = __builtin_popcount (src[i]);
27 }
28
29 void
30 __attribute__ ((noipa, optimize("-O3")))
31 popcountb_256 (unsigned char * __restrict dest, unsigned char* src)
32 {
33 for (int i = 0; i != 32; i++)
34 dest[i] = __builtin_popcount (src[i]);
35 }
36
37 void
38 __attribute__ ((noipa, optimize("-O3")))
39 popcountw_256 (unsigned short* __restrict dest, unsigned short* src)
40 {
41 for (int i = 0; i != 16; i++)
42 dest[i] = __builtin_popcount (src[i]);
43 }
44
45 void
46 __attribute__ ((noipa, optimize("-O3")))
47 popcountb_512 (unsigned char * __restrict dest, unsigned char* src)
48 {
49 for (int i = 0; i != 64; i++)
50 dest[i] = __builtin_popcount (src[i]);
51 }
52
53 void
54 __attribute__ ((noipa, optimize("-O3")))
55 popcountw_512 (unsigned short* __restrict dest, unsigned short* src)
56 {
57 for (int i = 0; i != 32; i++)
58 dest[i] = __builtin_popcount (src[i]);
59 }