llvm-project/flang/test/Semantics/OpenMP/loop-transformation-construct04.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

48 lines
1002 B
Fortran

! Testing the Semantic failure of forming loop sequences under regular OpenMP directives
!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=60
subroutine loop_transformation_construct3
implicit none
integer, parameter :: i = 5
integer :: x
integer :: v(i)
!ERROR: The loop sequence following the DO construct must be fully fused first.
!$omp do
!$omp fuse looprange(1,2)
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
!$omp end fuse
!$omp end do
end subroutine
subroutine loop_transformation_construct4
implicit none
integer, parameter :: i = 5
integer :: x
integer :: v(i)
!ERROR: The loop sequence following the TILE construct must be fully fused first.
!$omp tile sizes(2)
!$omp fuse looprange(1,2)
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
!$omp end fuse
!$omp end tile
end subroutine