brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 9f98ac8 Raw
100 lines · plain
1!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s2 3!===============================================================================4! parallel construct with function call which has master construct internally5!===============================================================================6!CHECK-LABEL: func @_QPomp_master7subroutine omp_master()8 9!CHECK: omp.master  {10!$omp master11 12    !CHECK: fir.call @_QPmaster() {{.*}}: () -> ()13    call master()14 15!CHECK: omp.terminator16!$omp end master17 18end subroutine omp_master19 20!CHECK-LABEL: func @_QPparallel_function_master21subroutine parallel_function_master()22 23!CHECK: omp.parallel {24!$omp parallel25 26    !CHECK: fir.call @_QPfoo() {{.*}}: () -> ()27    call foo()28 29!CHECK: omp.terminator30!$omp end parallel31 32end subroutine parallel_function_master33 34!===============================================================================35! master construct nested inside parallel construct36!===============================================================================37 38!CHECK-LABEL: func @_QPomp_parallel_master39subroutine omp_parallel_master()40 41!CHECK: omp.parallel {42!$omp parallel43    !CHECK: fir.call @_QPparallel() {{.*}}: () -> ()44    call parallel()45 46!CHECK: omp.master {47!$omp master48 49    !CHECK: fir.call @_QPparallel_master() {{.*}}: () -> ()50    call parallel_master()51 52!CHECK: omp.terminator53!$omp end master54 55!CHECK: omp.terminator56!$omp end parallel57 58end subroutine omp_parallel_master59 60!===============================================================================61! master construct nested inside parallel construct with conditional flow62!===============================================================================63 64!CHECK-LABEL: func @_QPomp_master_parallel65subroutine omp_master_parallel()66    integer :: alpha, beta, gama67    alpha = 468    beta = 569    gama = 670 71!CHECK: omp.master {72!$omp master73 74    !CHECK: %{{.*}} = fir.load %{{.*}}75    !CHECK: %{{.*}} = fir.load %{{.*}}76    !CHECK: %[[RESULT:.*]] = arith.cmpi sge, %{{.*}}, %{{.*}}77    !CHECK: fir.if %[[RESULT]] {78    if (alpha .ge. gama) then79 80!CHECK: omp.parallel {81!$omp parallel82        !CHECK: fir.call @_QPinside_if_parallel() {{.*}}: () -> ()83        call inside_if_parallel()84 85!CHECK: omp.terminator86!$omp end parallel87 88        !CHECK: %{{.*}} = fir.load %{{.*}}89        !CHECK: %{{.*}} = fir.load %{{.*}}90        !CHECK: %{{.*}} = arith.addi %{{.*}}, %{{.*}}91        !CHECK: hlfir.assign %{{.*}} to %{{.*}}#0 : i32, !fir.ref<i32>92        beta = alpha + gama93    end if94    !CHECK: }95 96!CHECK: omp.terminator97!$omp end master98 99end subroutine omp_master_parallel100