| 1 |
/* { dg-require-effective-target vect_simd_clones } */ |
| 2 |
/* { dg-additional-options "-fopenmp-simd" } */ |
| 3 |
/* { dg-additional-options "-mavx" { target avx_runtime } } */ |
| 4 |
|
| 5 |
#include "tree-vect.h" |
| 6 |
|
| 7 |
#ifndef N |
| 8 |
#define N 1024 |
| 9 |
#endif |
| 10 |
|
| 11 |
int array[N] __attribute__((aligned (32))); |
| 12 |
|
| 13 |
#pragma omp declare simd simdlen(4) notinbranch aligned(a:16) uniform(a) linear(b) |
| 14 |
#pragma omp declare simd simdlen(4) notinbranch aligned(a:32) uniform(a) linear(b) |
| 15 |
#ifdef __aarch64__ |
| 16 |
#pragma omp declare simd simdlen(2) notinbranch aligned(a:16) uniform(a) linear(b) |
| 17 |
#pragma omp declare simd simdlen(2) notinbranch aligned(a:32) uniform(a) linear(b) |
| 18 |
#else |
| 19 |
#pragma omp declare simd simdlen(8) notinbranch aligned(a:16) uniform(a) linear(b) |
| 20 |
#pragma omp declare simd simdlen(8) notinbranch aligned(a:32) uniform(a) linear(b) |
| 21 |
#endif |
| 22 |
__attribute__((noinline)) void |
| 23 |
foo (int *a, int b, int c) |
| 24 |
/* { dg-warning {unsupported simdlen 8 \(amdgcn\)} "" { target amdgcn*-*-* } .-1 } */ |
| 25 |
/* { dg-warning {unsupported simdlen 4 \(amdgcn\)} "" { target amdgcn*-*-* } .-2 } */ |
| 26 |
{ |
| 27 |
a[b] = c; |
| 28 |
} |
| 29 |
|
| 30 |
__attribute__((noinline, noclone)) void |
| 31 |
bar () |
| 32 |
{ |
| 33 |
int i; |
| 34 |
#pragma omp simd |
| 35 |
for (i = 0; i < N; ++i) |
| 36 |
foo (array, i, i * array[i]); |
| 37 |
} |
| 38 |
|
| 39 |
__attribute__((noinline, noclone)) void |
| 40 |
baz () |
| 41 |
{ |
| 42 |
int i; |
| 43 |
for (i = 0; i < N; i++) |
| 44 |
array[i] = 5 * (i & 7); |
| 45 |
} |
| 46 |
|
| 47 |
int |
| 48 |
main () |
| 49 |
{ |
| 50 |
int i; |
| 51 |
check_vect (); |
| 52 |
baz (); |
| 53 |
bar (); |
| 54 |
#pragma GCC novector |
| 55 |
for (i = 0; i < N; i++) |
| 56 |
if (array[i] != 5 * (i & 7) * i) |
| 57 |
abort (); |
| 58 |
return 0; |
| 59 |
} |