| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mavx512vpopcntdq -mavx512bitalg -mavx512vl" } */ |
| 3 |
/* { dg-final { scan-assembler-times "vpopcntd\[^\n\r\]*xmm\[0-9\]" 1 { target { ! ia32 } } } } */ |
| 4 |
/* { dg-final { scan-assembler-times "vpopcntw\[^\n\r\]*xmm\[0-9\]" 3 { target ia32 } } } */ |
| 5 |
/* { dg-final { scan-assembler-times "vpopcntw\[^\n\r\]*xmm\[0-9\]" 2 { target { ! ia32 } } } } */ |
| 6 |
/* { dg-final { scan-assembler-times "vpopcntb\[^\n\r\]*xmm\[0-9\]" 4 { target ia32 } } } */ |
| 7 |
/* { dg-final { scan-assembler-times "vpopcntb\[^\n\r\]*xmm\[0-9\]" 3 { target { ! ia32 } } } } */ |
| 8 |
|
| 9 |
void |
| 10 |
foo1 (int* a, int* __restrict b) |
| 11 |
{ |
| 12 |
for (int i = 0; i != 2; i++) |
| 13 |
a[i] = __builtin_popcount (b[i]); |
| 14 |
} |
| 15 |
|
| 16 |
void |
| 17 |
foo2 (unsigned short* a, unsigned short* __restrict b) |
| 18 |
{ |
| 19 |
for (int i = 0; i != 4; i++) |
| 20 |
a[i] = __builtin_popcount (b[i]); |
| 21 |
} |
| 22 |
|
| 23 |
void |
| 24 |
foo3 (unsigned short* a, unsigned short* __restrict b) |
| 25 |
{ |
| 26 |
for (int i = 0; i != 2; i++) |
| 27 |
a[i] = __builtin_popcount (b[i]); |
| 28 |
} |
| 29 |
|
| 30 |
void |
| 31 |
foo4 (unsigned char* a, unsigned char* __restrict b) |
| 32 |
{ |
| 33 |
for (int i = 0; i != 8; i++) |
| 34 |
a[i] = __builtin_popcount (b[i]); |
| 35 |
} |
| 36 |
|
| 37 |
void |
| 38 |
foo5 (unsigned char* a, unsigned char* __restrict b) |
| 39 |
{ |
| 40 |
for (int i = 0; i != 4; i++) |
| 41 |
a[i] = __builtin_popcount (b[i]); |
| 42 |
} |
| 43 |
|
| 44 |
void |
| 45 |
foo6 (unsigned char* a, unsigned char* __restrict b) |
| 46 |
{ |
| 47 |
for (int i = 0; i != 2; i++) |
| 48 |
a[i] = __builtin_popcount (b[i]); |
| 49 |
} |