This PR changes the build system to use use the sources for the module `omp_lib` and the `omp_lib.h` include file from the `openmp` runtime project and not from a separate copy of these files. This will greatly reduce potential for inconsistencies when adding features to the OpenMP runtime implementation. When the OpenMP subproject is not configured, this PR also disables the corresponding LIT tests with a "REQUIRES" directive at the beginning of the OpenMP test files. --------- Co-authored-by: Valentin Clement (バレンタイン クレメン) <clementval@gmail.com>
61 lines
1.9 KiB
Fortran
61 lines
1.9 KiB
Fortran
! REQUIRES: openmp_runtime
|
|
|
|
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
|
|
|
|
!===============================================================================
|
|
! Parallel sections construct
|
|
!===============================================================================
|
|
|
|
!CHECK: func @_QPomp_parallel_sections
|
|
subroutine omp_parallel_sections(x, y)
|
|
integer, intent(inout) :: x, y
|
|
!CHECK: omp.parallel {
|
|
!CHECK: omp.sections {
|
|
!$omp parallel sections
|
|
!CHECK: omp.section {
|
|
!$omp section
|
|
!CHECK: fir.load
|
|
!CHECK: arith.addi
|
|
!CHECK: hlfir.assign
|
|
x = x + 12
|
|
!CHECK: omp.terminator
|
|
!CHECK: omp.section {
|
|
!$omp section
|
|
!CHECK: fir.load
|
|
!CHECK: arith.subi
|
|
!CHECK: hlfir.assign
|
|
y = y - 5
|
|
!CHECK: omp.terminator
|
|
!CHECK: omp.terminator
|
|
!CHECK: omp.terminator
|
|
!$omp end parallel sections
|
|
end subroutine omp_parallel_sections
|
|
|
|
!===============================================================================
|
|
! Parallel sections construct with allocate clause
|
|
!===============================================================================
|
|
|
|
!CHECK: func @_QPomp_parallel_sections
|
|
subroutine omp_parallel_sections_allocate(x, y)
|
|
use omp_lib
|
|
integer, intent(inout) :: x, y
|
|
!CHECK: %[[allocator_1:.*]] = arith.constant 4 : i64
|
|
!CHECK: %[[allocator_2:.*]] = arith.constant 4 : i64
|
|
!CHECK: omp.parallel allocate(
|
|
!CHECK: %[[allocator_2]] : i64 -> %{{.*}} : !fir.ref<i32>) {
|
|
!CHECK: omp.sections allocate(
|
|
!CHECK: %[[allocator_1]] : i64 -> %{{.*}} : !fir.ref<i32>) {
|
|
!$omp parallel sections allocate(omp_high_bw_mem_alloc: x)
|
|
!CHECK: omp.section {
|
|
!$omp section
|
|
x = x + 12
|
|
!CHECK: omp.terminator
|
|
!CHECK: omp.section {
|
|
!$omp section
|
|
y = y + 5
|
|
!CHECK: omp.terminator
|
|
!CHECK: omp.terminator
|
|
!CHECK: omp.terminator
|
|
!$omp end parallel sections
|
|
end subroutine omp_parallel_sections_allocate
|