| 1 |
/* PR tree-optimization/88464 */ |
| 2 |
/* { dg-do run { target { avx512f } } } */ |
| 3 |
/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512 -mgather" } */ |
| 4 |
|
| 5 |
#include "avx512f-check.h" |
| 6 |
|
| 7 |
#include "avx512f-pr88464-7.c" |
| 8 |
|
| 9 |
static void |
| 10 |
avx512f_test (void) |
| 11 |
{ |
| 12 |
long long a[1024], b[1024]; |
| 13 |
int c[1024], f[1024]; |
| 14 |
int d[1024]; |
| 15 |
long e[1024]; |
| 16 |
int i; |
| 17 |
for (i = 0; i < 1024; i++) |
| 18 |
{ |
| 19 |
asm volatile ("" : "+g" (i)); |
| 20 |
a[i] = -5; |
| 21 |
b[i] = (i % 3) != 0 ? 2 * i : -5; |
| 22 |
d[i] = (i % 3) != 0 ? 1023 - i : __INT_MAX__; |
| 23 |
} |
| 24 |
f1 (a, b, d, 1024); |
| 25 |
for (i = 0; i < 1024; i++) |
| 26 |
{ |
| 27 |
asm volatile ("" : "+g" (i)); |
| 28 |
if (a[i] != ((i % 3) != 0 ? (1023 - i) * 2 : -5)) |
| 29 |
abort (); |
| 30 |
a[i] = -5; |
| 31 |
b[i] = (i % 3) != 1 ? 3 * i : -5; |
| 32 |
e[i] = (i % 3) != 1 ? 1023 - i : __LONG_MAX__; |
| 33 |
} |
| 34 |
f2 (a, b, e, 1024); |
| 35 |
for (i = 0; i < 1024; i++) |
| 36 |
{ |
| 37 |
asm volatile ("" : "+g" (i)); |
| 38 |
if (a[i] != ((i % 3) != 2 ? (1023 - i) * 3 : -5)) |
| 39 |
abort (); |
| 40 |
c[i] = -5; |
| 41 |
d[i] = (i % 3) != 2 ? 1023 - i : __INT_MAX__; |
| 42 |
f[i] = (i % 3) != 2 ? 4 * i : -5; |
| 43 |
} |
| 44 |
f3 (c, f, d, 1024); |
| 45 |
for (i = 0; i < 1024; i++) |
| 46 |
{ |
| 47 |
asm volatile ("" : "+g" (i)); |
| 48 |
if (c[i] != ((i % 3) != 1 ? (1023 - i) * 4 : -5)) |
| 49 |
abort (); |
| 50 |
c[i] = -5; |
| 51 |
e[i] = (i % 3) != 0 ? 1023 - i : __INT_MAX__; |
| 52 |
f[i] = (i % 3) != 0 ? 5 * i : -5; |
| 53 |
} |
| 54 |
f4 (c, f, e, 1024); |
| 55 |
for (i = 0; i < 1024; i++) |
| 56 |
{ |
| 57 |
asm volatile ("" : "+g" (i)); |
| 58 |
if (c[i] != ((i % 3) != 0 ? (1023 - i) * 5 : -5)) |
| 59 |
abort (); |
| 60 |
} |
| 61 |
} |