1 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
2 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect"
4 !===============================================================================
5 ! Parallel sections construct
6 !===============================================================================
8 !FIRDialect: func @_QPomp_parallel_sections
9 subroutine omp_parallel_sections(x
, y
)
10 integer, intent(inout
) :: x
, y
11 !OMPDialect: omp.parallel {
12 !OMPDialect: omp.sections {
13 !$omp parallel sections
14 !OMPDialect: omp.section {
17 !FIRDialect: arith.addi
18 !FIRDialect: fir.store
20 !OMPDialect: omp.terminator
21 !OMPDialect: omp.section {
24 !FIRDialect: arith.subi
25 !FIRDialect: fir.store
27 !OMPDialect: omp.terminator
28 !OMPDialect: omp.terminator
29 !OMPDialect: omp.terminator
30 !$omp end parallel sections
31 end subroutine omp_parallel_sections
33 !===============================================================================
34 ! Parallel sections construct with allocate clause
35 !===============================================================================
37 !FIRDialect: func @_QPomp_parallel_sections
38 subroutine omp_parallel_sections_allocate(x
, y
)
40 integer, intent(inout
) :: x
, y
41 !FIRDialect: %[[allocator:.*]] = arith.constant 1 : i32
42 !LLVMDialect: %[[allocator:.*]] = llvm.mlir.constant(1 : i32) : i32
43 !OMPDialect: omp.parallel {
44 !OMPDialect: omp.sections allocate(
45 !FIRDialect: %[[allocator]] : i32 -> %{{.*}} : !fir.ref<i32>) {
46 !LLVMDialect: %[[allocator]] : i32 -> %{{.*}} : !llvm.ptr<i32>) {
47 !$omp parallel sections allocate(omp_high_bw_mem_alloc: x)
48 !OMPDialect: omp.section {
51 !OMPDialect: omp.terminator
52 !OMPDialect: omp.section {
55 !OMPDialect: omp.terminator
56 !OMPDialect: omp.terminator
57 !OMPDialect: omp.terminator
58 !$omp end parallel sections
59 end subroutine omp_parallel_sections_allocate