xref: /llvm-project/flang/test/Lower/OpenMP/wsloop-schedule.f90 (revision 937cbce14c9aa956342a9c818c26a8a557802843)
1! This test checks lowering of OpenMP DO Directive(Worksharing) with
2! simd schedule modifier.
3
4! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
5
6program wsloop_dynamic
7  integer :: i
8!CHECK-LABEL: func @_QQmain()
9
10!$OMP PARALLEL
11!CHECK:  omp.parallel {
12
13!$OMP DO SCHEDULE(simd: runtime)
14!CHECK:      %[[WS_LB:.*]] = arith.constant 1 : i32
15!CHECK:      %[[WS_UB:.*]] = arith.constant 9 : i32
16!CHECK:      %[[WS_STEP:.*]] = arith.constant 1 : i32
17!CHECK:      omp.wsloop nowait schedule(runtime, simd) {
18!CHECK-NEXT:   omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) {
19!CHECK:          fir.store %[[I]] to %[[STORE:.*]]#1 : !fir.ref<i32>
20
21  do i=1, 9
22    print*, i
23!CHECK:          %[[RTBEGIN:.*]] = fir.call @_FortranAioBeginExternalListOutput
24!CHECK:          %[[LOAD:.*]] = fir.load %[[STORE]]#0 : !fir.ref<i32>
25!CHECK:          fir.call @_FortranAioOutputInteger32(%[[RTBEGIN]], %[[LOAD]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
26!CHECK:          fir.call @_FortranAioEndIoStatement(%[[RTBEGIN]]) {{.*}}: (!fir.ref<i8>) -> i32
27  end do
28!CHECK:          omp.yield
29!CHECK:        }
30!CHECK:      }
31!CHECK:      omp.terminator
32!CHECK:    }
33
34!$OMP END DO NOWAIT
35!$OMP END PARALLEL
36end
37