| 1 |
! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=host %s -o - \ |
| 2 |
! RUN: | FileCheck %s |
| 3 |
|
| 4 |
program main |
| 5 |
implicit none |
| 6 |
|
| 7 |
call foo(10) |
| 8 |
|
| 9 |
contains |
| 10 |
subroutine foo(n) |
| 11 |
implicit none |
| 12 |
integer :: n |
| 13 |
integer :: i |
| 14 |
integer, dimension(n) :: a |
| 15 |
|
| 16 |
do concurrent(i=1:n) |
| 17 |
a(i) = i |
| 18 |
end do |
| 19 |
end subroutine |
| 20 |
|
| 21 |
end program main |
| 22 |
|
| 23 |
! CHECK: %[[N_DECL:.*]]:2 = hlfir.declare %{{.*}} dummy_scope %{{.*}} {uniq_name = "_QFFfooEn"} |
| 24 |
|
| 25 |
! CHECK: fir.load |
| 26 |
|
| 27 |
! CHECK: %[[LB:.*]] = fir.convert %{{c1_.*}} : (i32) -> index |
| 28 |
! CHECK: %[[N_VAL:.*]] = fir.load %[[N_DECL]]#0 : !fir.ref<i32> |
| 29 |
! CHECK: %[[UB:.*]] = fir.convert %[[N_VAL]] : (i32) -> index |
| 30 |
! CHECK: %[[C1:.*]] = arith.constant 1 : index |
| 31 |
|
| 32 |
! CHECK: omp.parallel { |
| 33 |
|
| 34 |
|
| 35 |
! Verify that we resort to using the outside value for the upper bound since it |
| 36 |
! is not originally a constant. |
| 37 |
|
| 38 |
! CHECK: omp.wsloop { |
| 39 |
! CHECK: omp.loop_nest (%{{.*}}) : index = (%[[LB]]) to (%[[UB]]) inclusive step (%{{.*}}) { |
| 40 |
! CHECK: omp.yield |
| 41 |
! CHECK: } |
| 42 |
! CHECK: } |
| 43 |
! CHECK: omp.terminator |
| 44 |
! CHECK: } |
| 45 |
|