Debian Codegraph @

flang/test/Transforms/DoConcurrent/not_perfectly_nested.f90

raw
1 ! Tests that if `do concurrent` is not perfectly nested in its parent loop, that
2 ! we skip converting the not-perfectly nested `do concurrent` loop.
3
4 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=host %s -o - \
5 ! RUN: | FileCheck %s
6
7 program main
8 integer, parameter :: n = 10
9 integer, parameter :: m = 20
10 integer, parameter :: l = 30
11 integer x;
12 integer :: a(n, m, l)
13
14 do concurrent(i=1:n)
15 x = 10
16 do concurrent(j=1:m, k=1:l)
17 a(i,j,k) = i * j + k
18 end do
19 end do
20 end
21
22 ! CHECK: omp.parallel {
23
24 ! CHECK: omp.wsloop {
25 ! CHECK: omp.loop_nest ({{[^[:space:]]+}}) {{.*}} {
26 ! CHECK: fir.do_concurrent {
27
28 ! CHECK: %[[ORIG_J_ALLOC:.*]] = fir.alloca i32 {bindc_name = "j"}
29 ! CHECK: %[[ORIG_J_DECL:.*]]:2 = hlfir.declare %[[ORIG_J_ALLOC]]
30
31 ! CHECK: %[[ORIG_K_ALLOC:.*]] = fir.alloca i32 {bindc_name = "k"}
32 ! CHECK: %[[ORIG_K_DECL:.*]]:2 = hlfir.declare %[[ORIG_K_ALLOC]]
33
34 ! CHECK: fir.do_concurrent.loop (%[[J_IV:.*]], %[[K_IV:.*]]) = {{.*}} {
35 ! CHECK: %[[J_IV_CONV:.*]] = fir.convert %[[J_IV]] : (index) -> i32
36 ! CHECK: fir.store %[[J_IV_CONV]] to %[[ORIG_J_DECL]]#0
37
38 ! CHECK: %[[K_IV_CONV:.*]] = fir.convert %[[K_IV]] : (index) -> i32
39 ! CHECK: fir.store %[[K_IV_CONV]] to %[[ORIG_K_DECL]]#0
40 ! CHECK: }
41 ! CHECK: }
42 ! CHECK: omp.yield
43 ! CHECK: }
44 ! CHECK: }
45 ! CHECK: omp.terminator
46 ! CHECK: }