1! This test checks lowering of OpenMP Flush Directive. 2 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" 5 6subroutine flush_standalone(a, b, c) 7 integer, intent(inout) :: a, b, c 8 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 15 16end subroutine flush_standalone 17 18subroutine flush_parallel(a, b, c) 19 integer, intent(inout) :: a, b, c 20 21!$omp parallel 22!OMPDialect: omp.parallel { 23 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 30 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> 35 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 41 42!OMPDialect: omp.terminator 43!$omp END parallel 44 45end subroutine flush_parallel 46