| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target avx512bw } */ |
| 3 |
/* { dg-options "-O2 -mavx512bw" } */ |
| 4 |
|
| 5 |
|
| 6 |
#ifndef CHECK |
| 7 |
#define CHECK "avx512f-check.h" |
| 8 |
#endif |
| 9 |
|
| 10 |
#define AVX512BW |
| 11 |
|
| 12 |
#include CHECK |
| 13 |
|
| 14 |
#include "avx512bw-vec-set-1.c" |
| 15 |
|
| 16 |
#define CALC_TEST(vtype, type, N, idx) \ |
| 17 |
do \ |
| 18 |
{ \ |
| 19 |
int i,val = idx * idx - idx * 3 + 16; \ |
| 20 |
type res[N],exp[N]; \ |
| 21 |
vtype resv; \ |
| 22 |
for (i = 0; i < N; i++) \ |
| 23 |
{ \ |
| 24 |
res[i] = i * i - i * 3 + 15; \ |
| 25 |
exp[i] = res[i]; \ |
| 26 |
} \ |
| 27 |
exp[idx] = val; \ |
| 28 |
resv = foo_##vtype (*(vtype *)&res[0], val, idx); \ |
| 29 |
for (i = 0; i < N; i++) \ |
| 30 |
{ \ |
| 31 |
if (resv[i] != exp[i]) \ |
| 32 |
abort (); \ |
| 33 |
} \ |
| 34 |
} \ |
| 35 |
while (0) |
| 36 |
|
| 37 |
static void |
| 38 |
test_512 (void) |
| 39 |
{ |
| 40 |
CALC_TEST (v64qi, char, 64, 50); |
| 41 |
CALC_TEST (v32hi, short, 32, 30); |
| 42 |
CALC_TEST (v16si, int, 16, 15); |
| 43 |
CALC_TEST (v8di, long long, 8, 7); |
| 44 |
} |