summaryrefslogtreecommitdiff
path: root/flang/test/Semantics/OpenMP/loop-transformation-construct02.f90
blob: 7cf7b15c41a621f8d1990fc47545bd2b9e9102a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
! Testing the Semantics of loop sequences combined with 
! nested Loop Transformation Constructs

!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=60

subroutine loop_transformation_construct1
  implicit none

  !$omp do
  !ERROR: The FUSE construct requires the END FUSE directive
  !$omp fuse 
end subroutine

subroutine loop_transformation_construct2
  implicit none

  !$omp do
  !ERROR: A DO loop must follow the FUSE directive
  !$omp fuse 
  !$omp end fuse
end subroutine

subroutine loop_transformation_construct3
  implicit none
  integer, parameter :: i = 5
  integer :: x
  integer :: v(i)

  !$omp do
  !$omp fuse
  do x = 1, i
    v(x) = v(x) * 2
  end do
  do x = 1, i
    v(x) = v(x) * 2
  end do
  !$omp end fuse
  !$omp end do
  !ERROR: The END FUSE directive must follow the DO loop associated with the loop construct
  !$omp end fuse
end subroutine

subroutine loop_transformation_construct4
  implicit none
  integer, parameter :: i = 5
  integer :: x
  integer :: v(i)

  !$omp do
  do x = 1, i
    v(x) = v(x) * 2
  end do
  !ERROR: A DO loop must follow the FUSE directive
  !$omp fuse
  !$omp end fuse
end subroutine

subroutine loop_transformation_construct5
  implicit none
  integer, parameter :: i = 5
  integer :: x
  integer :: v(i)

  !$omp do
  !ERROR: If a loop construct has been fully unrolled, it cannot then be further transformed
  !$omp fuse
  !$omp unroll full
  do x = 1, i
    v(x) = v(x) * 2
  end do
  do x = 1, i
    v(x) = v(x) * 2
  end do
  !$omp end fuse
end subroutine

subroutine loop_transformation_construct6
  implicit none
  integer, parameter :: i = 5
  integer :: x
  integer :: v(i)

  !$omp do
  !$omp fuse looprange(1,1)
  !$omp unroll partial(2)
  do x = 1, i
    v(x) = v(x) * 2
  end do
  do x = 1, i
    v(x) = v(x) * 2
  end do
  !$omp end fuse 
end subroutine