| 1 |
! This test checks location of OpenMP constructs and clauses |
| 2 |
|
| 3 |
!RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --mlir-print-debuginfo %s -o - | FileCheck %s |
| 4 |
|
| 5 |
!CHECK-LABEL: sub_parallel |
| 6 |
subroutine sub_parallel() |
| 7 |
print *, x |
| 8 |
!CHECK: omp.parallel { |
| 9 |
!$omp parallel |
| 10 |
print *, x |
| 11 |
!CHECK: omp.terminator loc(#[[PAR_LOC:.*]]) |
| 12 |
!CHECK: } loc(#[[PAR_LOC]]) |
| 13 |
!$omp end parallel |
| 14 |
print *, x |
| 15 |
end |
| 16 |
|
| 17 |
!CHECK-LABEL: sub_target |
| 18 |
subroutine sub_target() |
| 19 |
print *, x |
| 20 |
!CHECK: omp.target {{.*}} { |
| 21 |
!$omp target |
| 22 |
print *, x |
| 23 |
!CHECK: omp.terminator loc(#[[TAR_LOC:.*]]) |
| 24 |
!CHECK: } loc(#[[TAR_LOC]]) |
| 25 |
!$omp end target |
| 26 |
print *, x |
| 27 |
end |
| 28 |
|
| 29 |
!CHECK-LABEL: sub_loop |
| 30 |
subroutine sub_loop() |
| 31 |
!CHECK: omp.wsloop { |
| 32 |
!CHECK-NEXT: omp.loop_nest {{.*}} { |
| 33 |
!$omp do |
| 34 |
do i=1,10 |
| 35 |
print *, i |
| 36 |
!CHECK: omp.yield loc(#[[LOOP_LOC:.*]]) |
| 37 |
!CHECK: } loc(#[[LOOP_LOC]]) |
| 38 |
!CHECK: omp.terminator loc(#[[LOOP_LOC]]) |
| 39 |
!CHECK: } loc(#[[LOOP_LOC]]) |
| 40 |
end do |
| 41 |
!$omp end do |
| 42 |
end |
| 43 |
|
| 44 |
!CHECK-LABEL: sub_standalone |
| 45 |
subroutine sub_standalone() |
| 46 |
!CHECK: omp.barrier loc(#[[BAR_LOC:.*]]) |
| 47 |
!$omp barrier |
| 48 |
!CHECK: omp.taskwait loc(#[[TW_LOC:.*]]) |
| 49 |
!$omp taskwait |
| 50 |
!CHECK: omp.taskyield loc(#[[TY_LOC:.*]]) |
| 51 |
!$omp taskyield |
| 52 |
end |
| 53 |
|
| 54 |
subroutine sub_if(c) |
| 55 |
logical(kind=4) :: c |
| 56 |
!CHECK: %[[CVT:.*]] = fir.convert %{{.*}} : (!fir.logical<4>) -> i1 loc(#[[IF_LOC:.*]]) |
| 57 |
!CHECK: omp.task if(%[[CVT]]) |
| 58 |
!$omp task if(c) |
| 59 |
print *, "Task" |
| 60 |
!$omp end task |
| 61 |
!CHECK: } loc(#[[TASK_LOC:.*]]) |
| 62 |
end subroutine |
| 63 |
|
| 64 |
!CHECK: #[[PAR_LOC]] = loc("{{.*}}location.f90":9:9) |
| 65 |
!CHECK: #[[TAR_LOC]] = loc("{{.*}}location.f90":21:9) |
| 66 |
!CHECK: #[[LOOP_LOC]] = loc("{{.*}}location.f90":33:9) |
| 67 |
!CHECK: #[[BAR_LOC]] = loc("{{.*}}location.f90":47:9) |
| 68 |
!CHECK: #[[TW_LOC]] = loc("{{.*}}location.f90":49:9) |
| 69 |
!CHECK: #[[TY_LOC]] = loc("{{.*}}location.f90":51:9) |
| 70 |
!CHECK: #[[IF_LOC]] = loc("{{.*}}location.f90":58:14) |
| 71 |
!CHECK: #[[TASK_LOC]] = loc("{{.*}}location.f90":58:9) |