| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=icelake-server -O3" } */ |
| 3 |
/* { dg-final { scan-assembler-times "vpopcntw\[ \t\]+" 4 } } */ |
| 4 |
/* 2 vplzcntd come from function clzw, the other 2 come from function clzb0. */ |
| 5 |
/* { dg-final { scan-assembler-times "vplzcntd\[ \t\]+" 4 } } */ |
| 6 |
|
| 7 |
void |
| 8 |
popcntw (unsigned short *p, unsigned short *q) |
| 9 |
{ |
| 10 |
for (unsigned int i = 0; i < 2048; ++i) |
| 11 |
p[i] = __builtin_popcount (q[i]); |
| 12 |
} |
| 13 |
|
| 14 |
void |
| 15 |
clzw (unsigned short *p, unsigned short* __restrict q) |
| 16 |
{ |
| 17 |
for (unsigned int i = 0; i < 2048; ++i) |
| 18 |
p[i] = __builtin_clz (q[i]); |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
ffsw (unsigned short *p, unsigned short* __restrict q) |
| 23 |
{ |
| 24 |
for (unsigned int i = 0; i < 2048; ++i) |
| 25 |
p[i] = __builtin_ffs (q[i]); |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
ctzw (unsigned short *p, unsigned short* __restrict q) |
| 30 |
{ |
| 31 |
for (unsigned int i = 0; i < 2048; ++i) |
| 32 |
p[i] = __builtin_ctz (q[i]); |
| 33 |
} |
| 34 |
|
| 35 |
void |
| 36 |
clzw0 (unsigned short *p, unsigned short* __restrict q) |
| 37 |
{ |
| 38 |
for (unsigned int i = 0; i < 2048; ++i) |
| 39 |
p[i] = q[i] ? __builtin_clz (q[i]) : 16; |
| 40 |
} |
| 41 |
|
| 42 |
void |
| 43 |
ctzw0 (unsigned short *p, unsigned short* __restrict q) |
| 44 |
{ |
| 45 |
for (unsigned int i = 0; i < 2048; ++i) |
| 46 |
p[i] = q[i] ? __builtin_ctz (q[i]) : 16; |
| 47 |
} |