| 1 |
/* { dg-do run { target aarch64_sve128_hw } } */ |
| 2 |
/* { dg-options "-O2 -fopenmp-simd -fno-trapping-math -msve-vector-bits=128 --param aarch64-autovec-preference=sve-only -fstack-protector-strong" } */ |
| 3 |
|
| 4 |
#pragma GCC target "+sve" |
| 5 |
|
| 6 |
[[gnu::noipa]] float f(float *ptr, long n) |
| 7 |
{ |
| 8 |
float res = 0.0f; |
| 9 |
#pragma omp simd reduction(+:res) |
| 10 |
for (long i = 0; i < n; ++i) |
| 11 |
if (ptr[i] >= 1.0f) |
| 12 |
res += ptr[i]; |
| 13 |
return res; |
| 14 |
} |
| 15 |
|
| 16 |
[[gnu::noipa]] float g(float *ptr, long n) |
| 17 |
{ |
| 18 |
return f(ptr, n) + 1; |
| 19 |
} |
| 20 |
|
| 21 |
int |
| 22 |
main () |
| 23 |
{ |
| 24 |
#define N 64 * 1024 |
| 25 |
float data[N]; |
| 26 |
for (long i = 0; i < N; ++i) |
| 27 |
data[i] = 1; |
| 28 |
if (g(data, N) != N + 1) |
| 29 |
__builtin_abort(); |
| 30 |
return 0; |
| 31 |
} |