| /* An inscan reduction on a collapsed simd loop takes the one-lane fallback. | |
| Compile only: the loop must not ICE in scan_omp_1_op, and simt_collapse_p | |
| must reject it. (The inscan result of such a loop is wrong on the host | |
| too, so there is nothing to run.) The scan splits the loop in two, so | |
| there are two notes. */ | |
| /* { dg-do compile } */ | |
| /* { dg-additional-options "-O2 -fdump-tree-omplower-details" } */ | |
| /* { dg-xfail-if "--param=offload-gpu-mode=simt-directed needs the amdgcn SIMT series" { offload_target_amdgcn } } */ | |
| /* { dg-additional-options "--param=offload-gpu-mode=simt-directed" { target offload_target_amdgcn } } */ | |
| #define N 37 | |
| #define M 23 | |
| int a[N * M]; | |
| void | |
| reduction_inscan (void) | |
| { | |
| int s = 0; | |
| #pragma omp target map(tofrom: a, s) | |
| #pragma omp parallel for simd collapse(2) reduction(inscan, +: s) | |
| for (int i = 0; i < N; i++) | |
| for (int j = 0; j < M; j++) | |
| { | |
| s += i * M + j; | |
| #pragma omp scan inclusive(s) | |
| a[i * M + j] = s; | |
| } | |
| } | |
| /* { dg-final { scan-tree-dump-times "collapsed loop cannot take the SIMT path: inscan reduction clause" 2 "omplower" { target { offload_target_amdgcn || offload_target_nvptx } } } } */ | |
| /* { dg-final { scan-tree-dump-times "collapsed loop cannot take the SIMT path" 2 "omplower" { target { offload_target_amdgcn || offload_target_nvptx } } } } */ |