| 1 |
/* PR target/96246 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-require-effective-target avx512bw } */ |
| 4 |
/* { dg-require-effective-target avx512vl } */ |
| 5 |
/* { dg-options "-O2 -std=c++14 -mavx512bw -mavx512vl" } */ |
| 6 |
/* { dg-skip-if "requires hosted libstdc++ for cstdlib malloc" { ! hostedlib } } */ |
| 7 |
|
| 8 |
#define AVX512VL |
| 9 |
#define AVX512BW |
| 10 |
|
| 11 |
#include "avx512f-helper.h" |
| 12 |
|
| 13 |
#include "avx512vl-pr96246-1.C" |
| 14 |
|
| 15 |
#define RUNTIME_TEST(vtype, num) \ |
| 16 |
do \ |
| 17 |
{ \ |
| 18 |
vtype a, b, c, d; \ |
| 19 |
vtype res; \ |
| 20 |
for (int i = 0; i != num; i++) \ |
| 21 |
{ \ |
| 22 |
a[i] = i * 2; \ |
| 23 |
b[i] = i * i - 5; \ |
| 24 |
c[i] = 1; \ |
| 25 |
d[i] = 0; \ |
| 26 |
} \ |
| 27 |
res = foo_##vtype (a, b, c, d); \ |
| 28 |
for (int i = 0; i != num; i++) \ |
| 29 |
if (res [i] != (a[i] > b[i] ? c[i] : d[i])) \ |
| 30 |
__builtin_abort (); \ |
| 31 |
} \ |
| 32 |
while (0) |
| 33 |
|
| 34 |
void |
| 35 |
test_256 (void) |
| 36 |
{ |
| 37 |
RUNTIME_TEST (v32qi, 32); |
| 38 |
RUNTIME_TEST (v16hi, 16); |
| 39 |
RUNTIME_TEST (v8si, 8); |
| 40 |
RUNTIME_TEST (v8sf, 8); |
| 41 |
RUNTIME_TEST (v4di, 4); |
| 42 |
RUNTIME_TEST (v4df, 4); |
| 43 |
} |
| 44 |
|
| 45 |
void |
| 46 |
test_128 (void) |
| 47 |
{ |
| 48 |
RUNTIME_TEST (v16qi, 16); |
| 49 |
RUNTIME_TEST (v4si, 4); |
| 50 |
RUNTIME_TEST (v4sf, 4); |
| 51 |
} |