xref: /llvm-project/flang/test/Parser/OpenMP/if-clause.f90 (revision 33faa8285f3dc5ca10e35770b288770b4bbc2bc1)
1! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=52 %s | FileCheck %s
2
3program openmp_parse_if
4  logical :: cond
5  integer :: i
6
7  ! CHECK: OmpSimpleStandaloneDirective -> llvm::omp::Directive = target update
8  ! CHECK-NEXT: OmpClause -> If -> OmpIfClause
9  ! CHECK-NOT: DirectiveNameModifier
10  !$omp target update if(cond) to(i)
11
12  ! CHECK: OmpSimpleStandaloneDirective -> llvm::omp::Directive = target update
13  ! CHECK-NEXT: OmpClause -> If -> OmpIfClause
14  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = target update
15  !$omp target update if(target update: cond) to(i)
16
17  ! CHECK: OmpSimpleStandaloneDirective -> llvm::omp::Directive = target enter data
18  ! CHECK: OmpClause -> If -> OmpIfClause
19  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = target enter data
20  !$omp target enter data map(to: i) if(target enter data: cond)
21
22  ! CHECK: OmpSimpleStandaloneDirective -> llvm::omp::Directive = target exit data
23  ! CHECK: OmpClause -> If -> OmpIfClause
24  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = target exit data
25  !$omp target exit data map(from: i) if(target exit data: cond)
26
27  ! CHECK: OmpBlockDirective -> llvm::omp::Directive = target data
28  ! CHECK: OmpClause -> If -> OmpIfClause
29  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = target data
30  !$omp target data map(tofrom: i) if(target data: cond)
31  !$omp end target data
32
33  ! CHECK: OmpLoopDirective -> llvm::omp::Directive = target teams distribute parallel do simd
34  ! CHECK: OmpClause -> If -> OmpIfClause
35  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = target
36  ! CHECK: OmpClause -> If -> OmpIfClause
37  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = teams
38  ! CHECK: OmpClause -> If -> OmpIfClause
39  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = parallel
40  ! CHECK: OmpClause -> If -> OmpIfClause
41  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = simd
42  !$omp target teams distribute parallel do simd if(target: cond) &
43  !$omp&    if(teams: cond) if(parallel: cond) if(simd: cond)
44  do i = 1, 10
45  end do
46  !$omp end target teams distribute parallel do simd
47
48  ! CHECK: OmpBlockDirective -> llvm::omp::Directive = task
49  ! CHECK-NEXT: OmpClause -> If -> OmpIfClause
50  ! CHECK-NEXT: OmpDirectiveNameModifier -> llvm::omp::Directive = task
51  !$omp task if(task: cond)
52  !$omp end task
53
54  ! CHECK: OmpLoopDirective -> llvm::omp::Directive = taskloop
55  ! CHECK-NEXT: OmpClause -> If -> OmpIfClause
56  ! CHECK-NEXT: DirectiveNameModifier -> llvm::omp::Directive = taskloop
57  !$omp taskloop if(taskloop: cond)
58  do i = 1, 10
59  end do
60  !$omp end taskloop
61end program openmp_parse_if
62