Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / OpenMP / wsloop-nonmonotonic.f90
blob5e4e66c77b343671505b366d0c0ecc7e526d1c06
1 ! This test checks lowering of OpenMP DO Directive(Worksharing) with
2 ! non-monotonic schedule modifier.
4 ! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s
6 program wsloop_dynamic
7 integer :: i
8 !CHECK-LABEL: func @_QQmain()
11 !$OMP PARALLEL
12 !CHECK: omp.parallel {
14 !$OMP DO SCHEDULE(nonmonotonic:dynamic)
15 !CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned}
16 !CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32
17 !CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32
18 !CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32
19 !CHECK: omp.wsloop schedule(dynamic, nonmonotonic) nowait for (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]])
20 !CHECK: fir.store %[[I]] to %[[ALLOCA_IV]] : !fir.ref<i32>
22 do i=1, 9
23 print*, i
24 !CHECK: %[[RTBEGIN:.*]] = fir.call @_FortranAioBeginExternalListOutput
25 !CHECK: %[[LOAD:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref<i32>
26 !CHECK: fir.call @_FortranAioOutputInteger32(%[[RTBEGIN]], %[[LOAD]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
27 !CHECK: fir.call @_FortranAioEndIoStatement(%[[RTBEGIN]]) {{.*}}: (!fir.ref<i8>) -> i32
28 end do
29 !CHECK: omp.yield
30 !CHECK: }
31 !CHECK: omp.terminator
32 !CHECK: }
34 !$OMP END DO NOWAIT
35 !$OMP END PARALLEL
36 end