| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -ftree-vectorize -ffast-math -mavx512bw -save-temps" } */ |
| 3 |
/* { dg-require-effective-target avx512bw } */ |
| 4 |
|
| 5 |
#include "avx512bw-check.h" |
| 6 |
|
| 7 |
#define N 400 |
| 8 |
unsigned char yy[10000]; |
| 9 |
unsigned char xx[10000]; |
| 10 |
|
| 11 |
void |
| 12 |
__attribute__ ((noinline)) foo (unsigned short s) |
| 13 |
{ |
| 14 |
unsigned short i; |
| 15 |
for (i = 0; i < s; i++) |
| 16 |
yy[i] = xx [i*2 + 1]; |
| 17 |
} |
| 18 |
|
| 19 |
void |
| 20 |
avx512bw_test () |
| 21 |
{ |
| 22 |
unsigned short i; |
| 23 |
unsigned char j = 0; |
| 24 |
for (i = 0; i < 2 * N + 1; i++, j++) |
| 25 |
xx [i] = j; |
| 26 |
|
| 27 |
foo (N); |
| 28 |
|
| 29 |
#pragma GCC novector |
| 30 |
for (i = 0; i < N; i++) |
| 31 |
if ( (unsigned char)(2*i+1) != yy [i] ) |
| 32 |
abort (); |
| 33 |
} |
| 34 |
|
| 35 |
/* { dg-final { scan-assembler-times "vpmovwb\[ \\t\]+\[^\n\]*%zmm" 2 } } */ |