| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */ |
| 3 |
/* { dg-require-effective-target avx512vl } */ |
| 4 |
|
| 5 |
#define AVX512VL |
| 6 |
#ifndef CHECK |
| 7 |
#define CHECK "avx512f-helper.h" |
| 8 |
#endif |
| 9 |
|
| 10 |
#include CHECK |
| 11 |
|
| 12 |
#include "cond_op_anylogic_d-1.c" |
| 13 |
#define BINO2(OPNAME, OP) \ |
| 14 |
void \ |
| 15 |
__attribute__ ((noipa,optimize ("O2"))) \ |
| 16 |
foo_o2_##OPNAME () \ |
| 17 |
{ \ |
| 18 |
for (int i = 0; i != NUM; i++) \ |
| 19 |
if (b[i] < c[i]) \ |
| 20 |
j[i] = d[i] OP e[i]; \ |
| 21 |
else \ |
| 22 |
j[i] = d[i] - e[i]; \ |
| 23 |
} |
| 24 |
|
| 25 |
BINO2 (and, &); |
| 26 |
BINO2 (ior, |); |
| 27 |
BINO2 (xor, ^); |
| 28 |
|
| 29 |
static void |
| 30 |
test_256 (void) |
| 31 |
{ |
| 32 |
int sign = -1; |
| 33 |
for (int i = 0; i != NUM; i++) |
| 34 |
{ |
| 35 |
a[i] = 0; |
| 36 |
d[i] = i * 2; |
| 37 |
e[i] = i * i * 3 - i * 9 + 153; |
| 38 |
b[i] = i * 83; |
| 39 |
c[i] = b[i] + sign; |
| 40 |
sign *= -1; |
| 41 |
j[i] = 1; |
| 42 |
} |
| 43 |
foo_and (); |
| 44 |
foo_o2_and (); |
| 45 |
for (int i = 0; i != NUM; i++) |
| 46 |
{ |
| 47 |
if (a[i] != j[i]) |
| 48 |
abort (); |
| 49 |
a[i] = 0; |
| 50 |
b[i] = 1; |
| 51 |
} |
| 52 |
|
| 53 |
foo_xor (); |
| 54 |
foo_o2_xor (); |
| 55 |
for (int i = 0; i != NUM; i++) |
| 56 |
{ |
| 57 |
if (a[i] != j[i]) |
| 58 |
abort (); |
| 59 |
a[i] = 0; |
| 60 |
j[i] = 1; |
| 61 |
} |
| 62 |
|
| 63 |
foo_ior (); |
| 64 |
foo_o2_ior (); |
| 65 |
for (int i = 0; i != NUM; i++) |
| 66 |
{ |
| 67 |
if (a[i] != j[i]) |
| 68 |
abort (); |
| 69 |
a[i] = 0; |
| 70 |
j[i] = 1; |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
static void |
| 75 |
test_128 () |
| 76 |
{ |
| 77 |
|
| 78 |
} |