Shraiysh Vaishay 51433662e2 [flang] Flush and master constructs
This patch adds tests for flush and master constructs

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122250

Co-authored By: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
2022-03-23 10:04:46 +05:30

42 lines
1.4 KiB
Fortran

! This test checks lowering of OpenMP Flush Directive.
!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect"
subroutine flush_standalone(a, b, c)
integer, intent(inout) :: a, b, c
!$omp flush(a,b,c)
!$omp flush
!OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} : !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
!OMPDialect: omp.flush
end subroutine flush_standalone
subroutine flush_parallel(a, b, c)
integer, intent(inout) :: a, b, c
!$omp parallel
!OMPDialect: omp.parallel {
!OMPDialect: omp.flush(%{{.*}}, %{{.*}}, %{{.*}} : !fir.ref<i32>, !fir.ref<i32>, !fir.ref<i32>)
!OMPDialect: omp.flush
!$omp flush(a,b,c)
!$omp flush
!FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref<i32>
!FIRDialect: %{{.*}} = fir.load %{{.*}} : !fir.ref<i32>
!FIRDialect: %{{.*}} = arith.addi %{{.*}}, %{{.*}} : i32
!FIRDialect: fir.store %{{.*}} to %{{.*}} : !fir.ref<i32>
!LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<i32>
!LLVMIRDialect: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<i32>
!LLVMIRDialect: %{{.*}} = llvm.add %{{.*}}, %{{.*}} : i32
!LLVMIRDialect: llvm.store %{{.*}}, %{{.*}} : !llvm.ptr<i32>
c = a + b
!OMPDialect: omp.terminator
!$omp END parallel
end subroutine flush_parallel