1 !RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
3 !===============================================================================
4 ! parallel construct with function call which has master construct internally
5 !===============================================================================
6 !CHECK-LABEL: func @_QPomp_master
7 subroutine omp_master()
12 !CHECK: fir.call @_QPmaster() {{.*}}: () -> ()
15 !CHECK: omp.terminator
18 end subroutine omp_master
20 !CHECK-LABEL: func @_QPparallel_function_master
21 subroutine parallel_function_master()
23 !CHECK: omp.parallel {
26 !CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
29 !CHECK: omp.terminator
32 end subroutine parallel_function_master
34 !===============================================================================
35 ! master construct nested inside parallel construct
36 !===============================================================================
38 !CHECK-LABEL: func @_QPomp_parallel_master
39 subroutine omp_parallel_master()
41 !CHECK: omp.parallel {
43 !CHECK: fir.call @_QPparallel() {{.*}}: () -> ()
49 !CHECK: fir.call @_QPparallel_master() {{.*}}: () -> ()
50 call parallel_master()
52 !CHECK: omp.terminator
55 !CHECK: omp.terminator
58 end subroutine omp_parallel_master
60 !===============================================================================
61 ! master construct nested inside parallel construct with conditional flow
62 !===============================================================================
64 !CHECK-LABEL: func @_QPomp_master_parallel
65 subroutine omp_master_parallel()
66 integer :: alpha
, beta
, gama
74 !CHECK: %{{.*}} = fir.load %{{.*}}
75 !CHECK: %{{.*}} = fir.load %{{.*}}
76 !CHECK: %[[RESULT:.*]] = arith.cmpi sge, %{{.*}}, %{{.*}}
77 !CHECK: fir.if %[[RESULT]] {
78 if (alpha
.ge
. gama
) then
80 !CHECK: omp.parallel {
82 !CHECK: fir.call @_QPinside_if_parallel() {{.*}}: () -> ()
83 call inside_if_parallel()
85 !CHECK: omp.terminator
88 !CHECK: %{{.*}} = fir.load %{{.*}}
89 !CHECK: %{{.*}} = fir.load %{{.*}}
90 !CHECK: %{{.*}} = arith.addi %{{.*}}, %{{.*}}
91 !CHECK: hlfir.assign %{{.*}} to %{{.*}}#0 : i32, !fir.ref<i32>
96 !CHECK: omp.terminator
99 end subroutine omp_master_parallel