1 ! This test checks lowering of OpenMP Flush Directive.
3 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
4 !RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="LLVMIRDialect,OMPDialect"
6 subroutine flush_standalone(a
, b
, c
)
7 integer, intent(inout
) :: a
, b
, c
11 !OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} :
12 !FIRDialect: !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
13 !LLVMIRDialect: !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>)
14 !OMPDialect: omp.flush
16 end subroutine flush_standalone
18 subroutine flush_parallel(a
, b
, c
)
19 integer, intent(inout
) :: a
, b
, c
22 !OMPDialect: omp.parallel {
24 !OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} :
25 !FIRDialect: !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
26 !LLVMIRDialect: !llvm.ptr<i32>, !llvm.ptr<i32>, !llvm.ptr<i32>)
27 !OMPDialect: omp.flush
31 !FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref<i32>
32 !FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref<i32>
33 !FIRDialect: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : i32
34 !FIRDialect: fir.store %{{.*}} to %{{.*}} : !fir.ref<i32>
36 !LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<i32>
37 !LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<i32>
38 !LLVMIRDialect: %{{.*}} = llvm.add %{{.*}}, %{{.*}} : i32
39 !LLVMIRDialect: llvm.store %{{.*}}, %{{.*}} : !llvm.ptr<i32>
42 !OMPDialect: omp.terminator
45 end subroutine flush_parallel