| 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 "vpopcntd\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */ |
| 5 |
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */ |
| 6 |
/* { dg-final { scan-assembler-times "vpopcntd\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */ |
| 7 |
/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*xmm" 1 } } */ |
| 8 |
/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*ymm" 1 } } */ |
| 9 |
/* { dg-final { scan-assembler-times "vpopcntq\[ \\t\]+\[^\\n\\r\]*zmm" 1 } } */ |
| 10 |
#ifndef AVX512VPOPCNTQ_H_INCLUDED |
| 11 |
#define AVX512VPOPCNTQ_H_INCLUDED |
| 12 |
|
| 13 |
#include <immintrin.h> |
| 14 |
|
| 15 |
void |
| 16 |
__attribute__ ((noipa, optimize("-O3"))) |
| 17 |
popcountd_128 (int* __restrict dest, int* src) |
| 18 |
{ |
| 19 |
for (int i = 0; i != 4; i++) |
| 20 |
dest[i] = __builtin_popcount (src[i]); |
| 21 |
} |
| 22 |
|
| 23 |
void |
| 24 |
__attribute__ ((noipa, optimize("-O3"))) |
| 25 |
popcountq_128 (long long* __restrict dest, long long* src) |
| 26 |
{ |
| 27 |
for (int i = 0; i != 2; i++) |
| 28 |
dest[i] = __builtin_popcountll (src[i]); |
| 29 |
} |
| 30 |
|
| 31 |
void |
| 32 |
__attribute__ ((noipa, optimize("-O3"))) |
| 33 |
popcountd_256 (int* __restrict dest, int* src) |
| 34 |
{ |
| 35 |
for (int i = 0; i != 8; i++) |
| 36 |
dest[i] = __builtin_popcount (src[i]); |
| 37 |
} |
| 38 |
|
| 39 |
void |
| 40 |
__attribute__ ((noipa, optimize("-O3"))) |
| 41 |
popcountq_256 (long long* __restrict dest, long long* src) |
| 42 |
{ |
| 43 |
for (int i = 0; i != 4; i++) |
| 44 |
dest[i] = __builtin_popcountll (src[i]); |
| 45 |
} |
| 46 |
|
| 47 |
void |
| 48 |
__attribute__ ((noipa, optimize("-O3"))) |
| 49 |
popcountd_512 (int* __restrict dest, int* src) |
| 50 |
{ |
| 51 |
for (int i = 0; i != 16; i++) |
| 52 |
dest[i] = __builtin_popcount (src[i]); |
| 53 |
} |
| 54 |
|
| 55 |
void |
| 56 |
__attribute__ ((noipa, optimize("-O3"))) |
| 57 |
popcountq_512 (long long* __restrict dest, long long* src) |
| 58 |
{ |
| 59 |
for (int i = 0; i != 8; i++) |
| 60 |
dest[i] = __builtin_popcountll (src[i]); |
| 61 |
} |
| 62 |
#endif |