brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · b4e02ea Raw
76 lines · plain
1! This test checks lowering of OpenMP DO Directive (Worksharing).2 3! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s4 5!CHECK-LABEL: func @_QPsimple_loop()6subroutine simple_loop7  integer :: i8  ! CHECK:  omp.parallel9  !$OMP PARALLEL10  ! CHECK:      %[[WS_LB:.*]] = arith.constant 1 : i3211  ! CHECK:      %[[WS_UB:.*]] = arith.constant 9 : i3212  ! CHECK:      %[[WS_STEP:.*]] = arith.constant 1 : i3213  ! CHECK:      omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[ALLOCA_IV:.*]] : !fir.ref<i32>) {14  ! CHECK-NEXT:   omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) {15  !$OMP DO16  do i=1, 917  ! CHECK:          %[[IV_DECL:.*]]:2 = hlfir.declare %[[ALLOCA_IV]] {uniq_name = "_QFsimple_loopEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)18  ! CHECK:          hlfir.assign %[[I]] to %[[IV_DECL:.*]]#0 : i32, !fir.ref<i32>19  ! CHECK:          %[[LOAD_IV:.*]] = fir.load %[[IV_DECL]]#0 : !fir.ref<i32>20  ! CHECK:          fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i121    print*, i22  end do23  ! CHECK:          omp.yield24  !$OMP END DO25  ! CHECK:      omp.terminator26  !$OMP END PARALLEL27end subroutine28 29!CHECK-LABEL: func @_QPsimple_loop_with_step()30subroutine simple_loop_with_step31  integer :: i32  ! CHECK:  omp.parallel33  !$OMP PARALLEL34  ! CHECK:      %[[WS_LB:.*]] = arith.constant 1 : i3235  ! CHECK:      %[[WS_UB:.*]] = arith.constant 9 : i3236  ! CHECK:      %[[WS_STEP:.*]] = arith.constant 2 : i3237  ! CHECK:      omp.wsloop private(@{{.*}} %{{.*}}#0 -> %[[ALLOCA_IV:.*]] : !fir.ref<i32>) {38  ! CHECK-NEXT:   omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) {39  ! CHECK:          %[[IV_DECL:.*]]:2 = hlfir.declare %[[ALLOCA_IV]] {uniq_name = "_QFsimple_loop_with_stepEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)40  ! CHECK:          hlfir.assign %[[I]] to %[[IV_DECL]]#0 : i32, !fir.ref<i32>41  ! CHECK:          %[[LOAD_IV:.*]] = fir.load %[[IV_DECL]]#0 : !fir.ref<i32>42  !$OMP DO43  do i=1, 9, 244  ! CHECK:          fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i145    print*, i46  end do47  ! CHECK:          omp.yield48  !$OMP END DO49  ! CHECK:      omp.terminator50  !$OMP END PARALLEL51end subroutine52 53!CHECK-LABEL: func @_QPloop_with_schedule_nowait()54subroutine loop_with_schedule_nowait55  integer :: i56  ! CHECK:  omp.parallel57  !$OMP PARALLEL58  ! CHECK:      %[[WS_LB:.*]] = arith.constant 1 : i3259  ! CHECK:      %[[WS_UB:.*]] = arith.constant 9 : i3260  ! CHECK:      %[[WS_STEP:.*]] = arith.constant 1 : i3261  ! CHECK:      omp.wsloop nowait schedule(runtime) private(@{{.*}} %{{.*}}#0 -> %[[ALLOCA_IV:.*]] : !fir.ref<i32>) {62  ! CHECK-NEXT:   omp.loop_nest (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]]) {63  !$OMP DO SCHEDULE(runtime)64  do i=1, 965  ! CHECK:          %[[IV_DECL:.*]]:2 = hlfir.declare %[[ALLOCA_IV]] {uniq_name = "_QFloop_with_schedule_nowaitEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)66  ! CHECK:          hlfir.assign %[[I]] to %[[IV_DECL]]#0 : i32, !fir.ref<i32>67  ! CHECK:          %[[LOAD_IV:.*]] = fir.load %[[IV_DECL]]#0 : !fir.ref<i32>68  ! CHECK:          fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i169    print*, i70  end do71  ! CHECK:          omp.yield72  !$OMP END DO NOWAIT73  ! CHECK:      omp.terminator74  !$OMP END PARALLEL75end subroutine76