1! This test checks lowering of OpenMP DO Directive (Worksharing). 2 3! RUN: bbc -fopenmp -emit-fir %s -o - | FileCheck %s 4 5!CHECK-LABEL: func @_QPsimple_loop() 6subroutine simple_loop 7 integer :: i 8 ! CHECK: omp.parallel 9 !$OMP PARALLEL 10 ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 11 ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 12 ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 13 ! CHECK: omp.wsloop for (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) 14 !$OMP DO 15 do i=1, 9 16 ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[I]]) : (!fir.ref<i8>, i32) -> i1 17 print*, i 18 end do 19 ! CHECK: omp.yield 20 !$OMP END DO 21 ! CHECK: omp.terminator 22 !$OMP END PARALLEL 23end subroutine 24 25!CHECK-LABEL: func @_QPsimple_loop_with_step() 26subroutine simple_loop_with_step 27 integer :: i 28 ! CHECK: omp.parallel 29 !$OMP PARALLEL 30 ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 31 ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 32 ! CHECK: %[[WS_STEP:.*]] = arith.constant 2 : i32 33 ! CHECK: omp.wsloop for (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) 34 !$OMP DO 35 do i=1, 9, 2 36 ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[I]]) : (!fir.ref<i8>, i32) -> i1 37 print*, i 38 end do 39 ! CHECK: omp.yield 40 !$OMP END DO 41 ! CHECK: omp.terminator 42 !$OMP END PARALLEL 43end subroutine 44 45!CHECK-LABEL: func @_QPloop_with_schedule_nowait() 46subroutine loop_with_schedule_nowait 47 integer :: i 48 ! CHECK: omp.parallel 49 !$OMP PARALLEL 50 ! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32 51 ! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32 52 ! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32 53 ! CHECK: omp.wsloop schedule(runtime) nowait for (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) 54 !$OMP DO SCHEDULE(runtime) 55 do i=1, 9 56 ! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[I]]) : (!fir.ref<i8>, i32) -> i1 57 print*, i 58 end do 59 ! CHECK: omp.yield 60 !$OMP END DO NOWAIT 61 ! CHECK: omp.terminator 62 !$OMP END PARALLEL 63end subroutine 64