| 1 |
/* PR target/96246 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-require-effective-target avx512bw } */ |
| 4 |
/* { dg-options "-O2 -std=c++14 -mavx512bw" } */ |
| 5 |
/* { dg-skip-if "requires hosted libstdc++ for cstdlib malloc" { ! hostedlib } } */ |
| 6 |
|
| 7 |
#define AVX512BW |
| 8 |
|
| 9 |
#include "avx512f-helper.h" |
| 10 |
|
| 11 |
#include "avx512bw-pr96246-1.C" |
| 12 |
|
| 13 |
#define RUNTIME_TEST(vtype, num) \ |
| 14 |
do \ |
| 15 |
{ \ |
| 16 |
vtype a, b, c, d; \ |
| 17 |
vtype res; \ |
| 18 |
for (int i = 0; i != num; i++) \ |
| 19 |
{ \ |
| 20 |
a[i] = i * 2; \ |
| 21 |
b[i] = i * i - 5; \ |
| 22 |
c[i] = 1; \ |
| 23 |
d[i] = 0; \ |
| 24 |
} \ |
| 25 |
res = foo_##vtype (a, b, c, d); \ |
| 26 |
for (int i = 0; i != num; i++) \ |
| 27 |
if (res [i] != (a[i] > b[i] ? c[i] : d[i])) \ |
| 28 |
__builtin_abort (); \ |
| 29 |
} \ |
| 30 |
while (0) |
| 31 |
|
| 32 |
void |
| 33 |
test_512 (void) |
| 34 |
{ |
| 35 |
RUNTIME_TEST (v64qi, 64); |
| 36 |
RUNTIME_TEST (v32hi, 32); |
| 37 |
RUNTIME_TEST (v16si, 16); |
| 38 |
RUNTIME_TEST (v8di, 8); |
| 39 |
RUNTIME_TEST (v16sf, 16); |
| 40 |
RUNTIME_TEST (v8df, 8); |
| 41 |
} |