| 1 |
/* { dg-do run { target aarch64_sve_hw } } */ |
| 2 |
/* { dg-options "-O2 -ftree-vectorize -ffast-math" } */ |
| 3 |
|
| 4 |
#ifndef FILENAME |
| 5 |
#define FILENAME "slp_7.c" |
| 6 |
#endif |
| 7 |
|
| 8 |
#include FILENAME |
| 9 |
|
| 10 |
#define N (54 * 4) |
| 11 |
|
| 12 |
#define HARNESS(TYPE) \ |
| 13 |
{ \ |
| 14 |
TYPE a[N], b[4] = { 40, 22, 75, 19 }; \ |
| 15 |
for (unsigned int i = 0; i < N; ++i) \ |
| 16 |
{ \ |
| 17 |
a[i] = i * 2 + i % 5; \ |
| 18 |
asm volatile ("" ::: "memory"); \ |
| 19 |
} \ |
| 20 |
vec_slp_##TYPE (a, b, N / 4); \ |
| 21 |
TYPE x0 = 40; \ |
| 22 |
TYPE x1 = 22; \ |
| 23 |
TYPE x2 = 75; \ |
| 24 |
TYPE x3 = 19; \ |
| 25 |
for (unsigned int i = 0; i < N; i += 4) \ |
| 26 |
{ \ |
| 27 |
x0 += a[i]; \ |
| 28 |
x1 += a[i + 1]; \ |
| 29 |
x2 += a[i + 2]; \ |
| 30 |
x3 += a[i + 3]; \ |
| 31 |
asm volatile ("" ::: "memory"); \ |
| 32 |
} \ |
| 33 |
/* _Float16 isn't precise enough for this. */ \ |
| 34 |
if ((TYPE) 0x1000 + 1 != (TYPE) 0x1000 \ |
| 35 |
&& (x0 != b[0] || x1 != b[1] || x2 != b[2] || x3 != b[3])) \ |
| 36 |
__builtin_abort (); \ |
| 37 |
} |
| 38 |
|
| 39 |
int __attribute__ ((optimize (1))) |
| 40 |
main (void) |
| 41 |
{ |
| 42 |
TEST_ALL (HARNESS) |
| 43 |
} |