summaryrefslogtreecommitdiff
path: root/flang/test/Parser/OpenMP/target-loop-unparse.f90
blob: 142bcabf0894bbb548d5cc29571f2414eaf98508 (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
! RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=50 %s | \
! RUN:   FileCheck --ignore-case %s

! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=50 %s | \
! RUN:   FileCheck --check-prefix="PARSE-TREE" %s

! Check for parsing of loop directive

subroutine test_loop
  integer :: i, j = 1
  !PARSE-TREE: OmpBeginLoopDirective
  !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = loop
  !CHECK: !$omp loop
  !$omp loop
  do i=1,10
   j = j + 1
  end do
  !$omp end loop

  !PARSE-TREE: OmpBeginLoopDirective
  !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = loop
  !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Bind -> OmpBindClause -> Binding = Thread
  !CHECK: !$omp loop
  !$omp loop bind(thread)
  do i=1,10
   j = j + 1
  end do
  !$omp end loop
end subroutine

subroutine test_target_loop
  integer :: i, j = 1
  !PARSE-TREE: OmpBeginLoopDirective
  !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = target loop
  !CHECK: !$omp target loop
  !$omp target loop
  do i=1,10
   j = j + 1
  end do
  !$omp end target loop
end subroutine

subroutine test_target_teams_loop
  integer :: i, j = 1
  !PARSE-TREE: OmpBeginLoopDirective
  !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = target teams loop
  !CHECK: !$omp target teams loop
  !$omp target teams loop
  do i=1,10
   j = j + 1
  end do
  !$omp end target teams loop
end subroutine

subroutine test_target_parallel_loop
  integer :: i, j = 1
  !PARSE-TREE: OmpBeginLoopDirective
  !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = target parallel loop
  !CHECK: !$omp target parallel loop
  !$omp target parallel loop
  do i=1,10
   j = j + 1
  end do
  !$omp end target parallel loop
end subroutine