Files
clang-p2996/flang/test/Lower/OpenMP/FIR/parallel-sections.f90
jeanPerier f35f863a88 [flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957)
Patch 2/3 of the transition step 1 described in

https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7.

All the modified tests are still here since coverage for the direct
lowering to FIR was still needed while it was default. Some already have
an HLFIR version, some have not and will need to be ported in step 2
described in the RFC.

Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do
not need a flag since the HLFIR/no HLFIR output is the same for what is
being tested.
2023-11-13 09:14:05 +01:00

64 lines
2.5 KiB
Fortran

!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | FileCheck %s --check-prefixes="FIRDialect,OMPDialect"
!RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -fopenmp %s -o - | fir-opt --cfg-conversion | fir-opt --fir-to-llvm-ir | FileCheck %s --check-prefixes="OMPDialect,LLVMDialect"
!===============================================================================
! Parallel sections construct
!===============================================================================
!FIRDialect: func @_QPomp_parallel_sections
subroutine omp_parallel_sections(x, y)
integer, intent(inout) :: x, y
!OMPDialect: omp.parallel {
!OMPDialect: omp.sections {
!$omp parallel sections
!OMPDialect: omp.section {
!$omp section
!FIRDialect: fir.load
!FIRDialect: arith.addi
!FIRDialect: fir.store
x = x + 12
!OMPDialect: omp.terminator
!OMPDialect: omp.section {
!$omp section
!FIRDialect: fir.load
!FIRDialect: arith.subi
!FIRDialect: fir.store
y = y - 5
!OMPDialect: omp.terminator
!OMPDialect: omp.terminator
!OMPDialect: omp.terminator
!$omp end parallel sections
end subroutine omp_parallel_sections
!===============================================================================
! Parallel sections construct with allocate clause
!===============================================================================
!FIRDialect: func @_QPomp_parallel_sections
subroutine omp_parallel_sections_allocate(x, y)
use omp_lib
integer, intent(inout) :: x, y
!FIRDialect: %[[allocator_1:.*]] = arith.constant 1 : i32
!FIRDialect: %[[allocator_2:.*]] = arith.constant 1 : i32
!LLVMDialect: %[[allocator_1:.*]] = llvm.mlir.constant(1 : i32) : i32
!LLVMDialect: %[[allocator_2:.*]] = llvm.mlir.constant(1 : i32) : i32
!OMPDialect: omp.parallel allocate(
!FIRDialect: %[[allocator_2]] : i32 -> %{{.*}} : !fir.ref<i32>) {
!LLVMDialect: %[[allocator_2]] : i32 -> %{{.*}} : !llvm.ptr) {
!OMPDialect: omp.sections allocate(
!FIRDialect: %[[allocator_1]] : i32 -> %{{.*}} : !fir.ref<i32>) {
!LLVMDialect: %[[allocator_1]] : i32 -> %{{.*}} : !llvm.ptr) {
!$omp parallel sections allocate(omp_high_bw_mem_alloc: x)
!OMPDialect: omp.section {
!$omp section
x = x + 12
!OMPDialect: omp.terminator
!OMPDialect: omp.section {
!$omp section
y = y + 5
!OMPDialect: omp.terminator
!OMPDialect: omp.terminator
!OMPDialect: omp.terminator
!$omp end parallel sections
end subroutine omp_parallel_sections_allocate