Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / OpenMP / flush.f90
blobe6970f47a7aa925b6aa502dc25e426063b46f06f
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
9 !$omp flush(a,b,c)
10 !$omp flush
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
21 !$omp parallel
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
28 !$omp flush(a,b,c)
29 !$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>
40 c = a + b
42 !OMPDialect: omp.terminator
43 !$omp END parallel
45 end subroutine flush_parallel