| 1 |
/* Ensure that the default safelen is set correctly for the larger of the host |
| 2 |
and offload device, to prevent defeating the vectorizer. */ |
| 3 |
|
| 4 |
/* { dg-require-effective-target offload_target_any } */ |
| 5 |
|
| 6 |
/* { dg-do link } */ |
| 7 |
/* { dg-options "-fopenmp -O2 -fdump-tree-omplower" } */ |
| 8 |
|
| 9 |
int f(float *a, float *b, int n) |
| 10 |
{ |
| 11 |
float sum = 0; |
| 12 |
#pragma omp target teams distribute parallel for simd map(tofrom: sum) reduction(+:sum) |
| 13 |
for (int i = 0; i < n; i++) |
| 14 |
sum += a[i] * b[i]; |
| 15 |
return sum; |
| 16 |
} |
| 17 |
|
| 18 |
/* Make sure that the max_vf used is suitable for the offload device. |
| 19 |
{ dg-final { scan-tree-dump-times {omp simd safelen\(64\)} 1 "omplower" { target offload_target_amdgcn } } } */ |
| 20 |
|
| 21 |
int main() {} |