llvm-project/flang/test/Parser/OpenMP/fuse-looprange.f90
Ferran Toda f4ebee0ca9
[Flang][OpenMP] Add semantic support for Loop Sequences and OpenMP loop fuse (#161213)
This patch adds semantics for the `omp fuse` directive in flang, as
specified in OpenMP 6.0. This patch also enables semantic support for
loop sequences which are needed for the fuse directive along with
semantics for the `looprange` clause. These changes are only semantic.
Relevant tests have been added , and previous behavior is retained with
no changes.

---------

Co-authored-by: Ferran Toda <ferran.todacasaban@bsc.es>
Co-authored-by: Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>
2025-11-21 08:16:30 -06:00

39 lines
1.0 KiB
Fortran

! RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=60 %s | FileCheck --ignore-case %s
! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=60 %s | FileCheck --check-prefix="PARSE-TREE" %s
subroutine openmp_fuse(x)
integer, intent(inout)::x
!CHECK: !$omp fuse looprange
!$omp fuse looprange(1,2)
!CHECK: do
do x = 1, 100
call F1()
!CHECK: end do
end do
!CHECK: do
do x = 1, 100
call F1()
!CHECK: end do
end do
!CHECK: do
do x = 1, 100
call F1()
!CHECK: end do
end do
!CHECK: !$omp end fuse
!$omp end fuse
!PARSE-TREE: OpenMPConstruct -> OpenMPLoopConstruct
!PARSE-TREE: OmpBeginLoopDirective
!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = fuse
!PARSE-TREE: OmpClauseList -> OmpClause -> Looprange -> OmpLoopRangeClause
!PARSE-TREE: Scalar -> Integer -> Constant -> Expr = '1_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
!PARSE-TREE: Scalar -> Integer -> Constant -> Expr = '2_4'
!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
END subroutine openmp_fuse