Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested.
73 lines
2.8 KiB
Fortran
73 lines
2.8 KiB
Fortran
! This test checks lowering of OpenMP DO Directive (Worksharing).
|
|
|
|
! RUN: bbc -fopenmp -emit-fir -hlfir=false %s -o - | FileCheck %s
|
|
|
|
!CHECK-LABEL: func @_QPsimple_loop()
|
|
subroutine simple_loop
|
|
integer :: i
|
|
! CHECK: omp.parallel
|
|
!$OMP PARALLEL
|
|
! CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned}
|
|
! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32
|
|
! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32
|
|
! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32
|
|
! CHECK: omp.wsloop for (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]])
|
|
!$OMP DO
|
|
do i=1, 9
|
|
! CHECK: fir.store %[[I]] to %[[ALLOCA_IV:.*]] : !fir.ref<i32>
|
|
! CHECK: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref<i32>
|
|
! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
|
|
print*, i
|
|
end do
|
|
! CHECK: omp.yield
|
|
!$OMP END DO
|
|
! CHECK: omp.terminator
|
|
!$OMP END PARALLEL
|
|
end subroutine
|
|
|
|
!CHECK-LABEL: func @_QPsimple_loop_with_step()
|
|
subroutine simple_loop_with_step
|
|
integer :: i
|
|
! CHECK: omp.parallel
|
|
!$OMP PARALLEL
|
|
! CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned}
|
|
! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32
|
|
! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32
|
|
! CHECK: %[[WS_STEP:.*]] = arith.constant 2 : i32
|
|
! CHECK: omp.wsloop for (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]])
|
|
! CHECK: fir.store %[[I]] to %[[ALLOCA_IV]] : !fir.ref<i32>
|
|
! CHECK: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref<i32>
|
|
!$OMP DO
|
|
do i=1, 9, 2
|
|
! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
|
|
print*, i
|
|
end do
|
|
! CHECK: omp.yield
|
|
!$OMP END DO
|
|
! CHECK: omp.terminator
|
|
!$OMP END PARALLEL
|
|
end subroutine
|
|
|
|
!CHECK-LABEL: func @_QPloop_with_schedule_nowait()
|
|
subroutine loop_with_schedule_nowait
|
|
integer :: i
|
|
! CHECK: omp.parallel
|
|
!$OMP PARALLEL
|
|
! CHECK: %[[ALLOCA_IV:.*]] = fir.alloca i32 {{{.*}}, pinned}
|
|
! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32
|
|
! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32
|
|
! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32
|
|
! CHECK: omp.wsloop schedule(runtime) nowait for (%[[I:.*]]) : i32 = (%[[WS_LB]]) to (%[[WS_UB]]) inclusive step (%[[WS_STEP]])
|
|
!$OMP DO SCHEDULE(runtime)
|
|
do i=1, 9
|
|
! CHECK: fir.store %[[I]] to %[[ALLOCA_IV]] : !fir.ref<i32>
|
|
! CHECK: %[[LOAD_IV:.*]] = fir.load %[[ALLOCA_IV]] : !fir.ref<i32>
|
|
! CHECK: fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
|
|
print*, i
|
|
end do
|
|
! CHECK: omp.yield
|
|
!$OMP END DO NOWAIT
|
|
! CHECK: omp.terminator
|
|
!$OMP END PARALLEL
|
|
end subroutine
|