71 lines · plain
1! This test checks location of OpenMP constructs and clauses2 3!RUN: %flang_fc1 -emit-hlfir -fopenmp -mmlir --mlir-print-debuginfo %s -o - | FileCheck %s4 5!CHECK-LABEL: sub_parallel6subroutine sub_parallel()7 print *, x8!CHECK: omp.parallel {9 !$omp parallel10 print *, x11!CHECK: omp.terminator loc(#[[PAR_LOC:.*]])12!CHECK: } loc(#[[PAR_LOC]])13 !$omp end parallel14 print *, x15end16 17!CHECK-LABEL: sub_target18subroutine sub_target()19 print *, x20!CHECK: omp.target {{.*}} {21 !$omp target22 print *, x23!CHECK: omp.terminator loc(#[[TAR_LOC:.*]])24!CHECK: } loc(#[[TAR_LOC]])25 !$omp end target26 print *, x27end28 29!CHECK-LABEL: sub_loop30subroutine sub_loop()31!CHECK: omp.wsloop private({{.*}}) {32!CHECK-NEXT: omp.loop_nest {{.*}} {33 !$omp do34 do i=1,1035 print *, i36!CHECK: omp.yield loc(#[[LOOP_LOC:.*]])37!CHECK: } loc(#[[LOOP_LOC]])38!CHECK: } loc(#[[LOOP_LOC]])39 end do40 !$omp end do41end42 43!CHECK-LABEL: sub_standalone44subroutine sub_standalone()45 !CHECK: omp.barrier loc(#[[BAR_LOC:.*]])46 !$omp barrier47 !CHECK: omp.taskwait loc(#[[TW_LOC:.*]])48 !$omp taskwait49 !CHECK: omp.taskyield loc(#[[TY_LOC:.*]])50 !$omp taskyield51end52 53subroutine sub_if(c)54 logical(kind=4) :: c55 !CHECK: %[[CVT:.*]] = fir.convert %{{.*}} : (!fir.logical<4>) -> i1 loc(#[[IF_LOC:.*]])56 !CHECK: omp.task if(%[[CVT]])57 !$omp task if(c)58 print *, "Task"59 !$omp end task60 !CHECK: } loc(#[[TASK_LOC:.*]])61end subroutine62 63!CHECK: #[[PAR_LOC]] = loc("{{.*}}location.f90":9:9)64!CHECK: #[[TAR_LOC]] = loc("{{.*}}location.f90":21:9)65!CHECK: #[[LOOP_LOC]] = loc("{{.*}}location.f90":33:9)66!CHECK: #[[BAR_LOC]] = loc("{{.*}}location.f90":46:9)67!CHECK: #[[TW_LOC]] = loc("{{.*}}location.f90":48:9)68!CHECK: #[[TY_LOC]] = loc("{{.*}}location.f90":50:9)69!CHECK: #[[IF_LOC]] = loc("{{.*}}location.f90":57:14)70!CHECK: #[[TASK_LOC]] = loc("{{.*}}location.f90":57:9)71