diff options
Diffstat (limited to 'flang/test/Parser/OpenMP')
| -rw-r--r-- | flang/test/Parser/OpenMP/assumption.f90 | 168 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/block-construct.f90 | 6 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/construct-prefix-conflict.f90 | 10 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/declare-reduction-unparse-with-symbols.f90 | 13 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/do-tile-size.f90 | 29 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/fail-construct1.f90 | 4 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/in-reduction-clause.f90 | 6 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/openmp6-directive-spellings.f90 | 2 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/ordered-block-vs-standalone.f90 | 60 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/proc-bind.f90 | 2 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/scope.f90 | 2 | ||||
| -rw-r--r-- | flang/test/Parser/OpenMP/workdistribute.f90 | 27 |
12 files changed, 274 insertions, 55 deletions
diff --git a/flang/test/Parser/OpenMP/assumption.f90 b/flang/test/Parser/OpenMP/assumption.f90 index f1cb0c87e126..0f333f99f908 100644 --- a/flang/test/Parser/OpenMP/assumption.f90 +++ b/flang/test/Parser/OpenMP/assumption.f90 @@ -1,59 +1,149 @@ -! RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s -! RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-dump-parse-tree-no-sema %s 2>&1 | FileCheck %s --check-prefix="PARSE-TREE" +!RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-unparse-no-sema %s | FileCheck --check-prefix="UNPARSE" %s +!RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-dump-parse-tree-no-sema %s | FileCheck --check-prefix="PARSE-TREE" %s + subroutine sub1 integer :: r -!CHECK: !$OMP ASSUME NO_OPENMP -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct -!PARSE-TREE: Verbatim -!PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmp !$omp assume no_openmp -!CHECK: !$OMP ASSUME NO_PARALLELISM -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct -!PARSE-TREE: Verbatim -!PARSE-TREE: OmpClauseList -> OmpClause -> NoParallelism + !$omp end assume + !$omp assume no_parallelism -!CHECK: !$OMP ASSUME NO_OPENMP_ROUTINES -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct -!PARSE-TREE: Verbatim -!PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmpRoutines + !$omp end assume + !$omp assume no_openmp_routines -!CHECK: !$OMP ASSUME ABSENT(ALLOCATE), CONTAINS(WORKSHARE,TASK) -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct -!PARSE-TREE: Verbatim -!PARSE-TREE: OmpClauseList -> OmpClause -> Absent -> OmpAbsentClause -> llvm::omp::Directive = allocate -!PARSE-TREE: OmpClause -> Contains -> OmpContainsClause -> llvm::omp::Directive = workshare -!PARSE-TREE: llvm::omp::Directive = task - !$omp assume absent(allocate), contains(workshare, task) -!CHECK: !$OMP ASSUME HOLDS(1==1) + !$omp end assume + + !$omp assume absent(allocate), contains(workshare, task) + block ! strictly-structured-block + end block + !$omp assume holds(1.eq.1) + block + end block print *, r end subroutine sub1 +!UNPARSE: SUBROUTINE sub1 +!UNPARSE: INTEGER r +!UNPARSE: !$OMP ASSUME NO_OPENMP +!UNPARSE: !$OMP END ASSUME +!UNPARSE: !$OMP ASSUME NO_PARALLELISM +!UNPARSE: !$OMP END ASSUME +!UNPARSE: !$OMP ASSUME NO_OPENMP_ROUTINES +!UNPARSE: !$OMP END ASSUME +!UNPARSE: !$OMP ASSUME ABSENT(ALLOCATE) CONTAINS(WORKSHARE,TASK) +!UNPARSE: BLOCK +!UNPARSE: END BLOCK +!UNPARSE: !$OMP ASSUME HOLDS(1==1) +!UNPARSE: BLOCK +!UNPARSE: END BLOCK +!UNPARSE: PRINT *, r +!UNPARSE: END SUBROUTINE sub1 + +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct +!PARSE-TREE: | OmpBeginDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> OmpClause -> NoOpenmp +!PARSE-TREE: | | Flags = None +!PARSE-TREE: | Block +!PARSE-TREE: | OmpEndDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> +!PARSE-TREE: | | Flags = None +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct +!PARSE-TREE: | OmpBeginDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> OmpClause -> NoParallelism +!PARSE-TREE: | | Flags = None +!PARSE-TREE: | Block +!PARSE-TREE: | OmpEndDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> +!PARSE-TREE: | | Flags = None +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct +!PARSE-TREE: | OmpBeginDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> OmpClause -> NoOpenmpRoutines +!PARSE-TREE: | | Flags = None +!PARSE-TREE: | Block +!PARSE-TREE: | OmpEndDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> +!PARSE-TREE: | | Flags = None +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct +!PARSE-TREE: | OmpBeginDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> OmpClause -> Absent -> OmpAbsentClause -> llvm::omp::Directive = allocate +!PARSE-TREE: | | OmpClause -> Contains -> OmpContainsClause -> llvm::omp::Directive = workshare +!PARSE-TREE: | | llvm::omp::Directive = task +!PARSE-TREE: | | Flags = None +!PARSE-TREE: | Block +!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> BlockConstruct +!PARSE-TREE: | | | BlockStmt -> +!PARSE-TREE: | | | BlockSpecificationPart -> SpecificationPart +!PARSE-TREE: | | | | ImplicitPart -> +!PARSE-TREE: | | | Block +!PARSE-TREE: | | | EndBlockStmt -> +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct +!PARSE-TREE: | OmpBeginDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> OmpClause -> Holds -> OmpHoldsClause -> Expr -> EQ +!PARSE-TREE: | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' +!PARSE-TREE: | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' +!PARSE-TREE: | | Flags = None +!PARSE-TREE: | Block +!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> BlockConstruct +!PARSE-TREE: | | | BlockStmt -> +!PARSE-TREE: | | | BlockSpecificationPart -> SpecificationPart +!PARSE-TREE: | | | | ImplicitPart -> +!PARSE-TREE: | | | Block +!PARSE-TREE: | | | EndBlockStmt -> + + subroutine sub2 integer :: r integer :: v -!CHECK !$OMP ASSUME NO_OPENMP -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct -!PARSE-TREE: OmpAssumeDirective -!PARSE-TREE: Verbatim -!PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmp -!PARSE-TREE: Block -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt -!PARSE-TREE: Expr -> Add -!PARSE-TREE: OmpEndAssumeDirective v = 87 !$omp assume no_openmp r = r + 1 -!CHECK !$OMP END ASSUME !$omp end assume end subroutine sub2 - + +!UNPARSE: SUBROUTINE sub2 +!UNPARSE: INTEGER r +!UNPARSE: INTEGER v +!UNPARSE: v = 87 +!UNPARSE: !$OMP ASSUME NO_OPENMP +!UNPARSE: r = r+1 +!UNPARSE: !$OMP END ASSUME +!UNPARSE: END SUBROUTINE sub2 + +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt +!PARSE-TREE: | Variable -> Designator -> DataRef -> Name = 'v' +!PARSE-TREE: | Expr -> LiteralConstant -> IntLiteralConstant = '87' +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct +!PARSE-TREE: | OmpBeginDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> OmpClause -> NoOpenmp +!PARSE-TREE: | | Flags = None +!PARSE-TREE: | Block +!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt +!PARSE-TREE: | | | Variable -> Designator -> DataRef -> Name = 'r' +!PARSE-TREE: | | | Expr -> Add +!PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'r' +!PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' +!PARSE-TREE: | OmpEndDirective +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume +!PARSE-TREE: | | OmpClauseList -> +!PARSE-TREE: | | Flags = None + program p -!CHECK !$OMP ASSUMES NO_OPENMP -!PARSE-TREE: SpecificationPart -!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclarativeAssumes -!PARSE-TREE: Verbatim -!PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmp !$omp assumes no_openmp end program p - + +!UNPARSE: PROGRAM p +!UNPARSE: !$OMP ASSUMES NO_OPENMP +!UNPARSE: END PROGRAM p + +!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclarativeAssumes +!PARSE-TREE: | Verbatim +!PARSE-TREE: | OmpClauseList -> OmpClause -> NoOpenmp diff --git a/flang/test/Parser/OpenMP/block-construct.f90 b/flang/test/Parser/OpenMP/block-construct.f90 index ea425544a553..fe987c20033e 100644 --- a/flang/test/Parser/OpenMP/block-construct.f90 +++ b/flang/test/Parser/OpenMP/block-construct.f90 @@ -19,7 +19,7 @@ end !UNPARSE: !$OMP END TARGET !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause @@ -71,7 +71,7 @@ end !UNPARSE: END BLOCK !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause @@ -128,7 +128,7 @@ end !UNPARSE: !$OMP END TARGET !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause diff --git a/flang/test/Parser/OpenMP/construct-prefix-conflict.f90 b/flang/test/Parser/OpenMP/construct-prefix-conflict.f90 index d6f5152b021f..4573a83c8e35 100644 --- a/flang/test/Parser/OpenMP/construct-prefix-conflict.f90 +++ b/flang/test/Parser/OpenMP/construct-prefix-conflict.f90 @@ -26,12 +26,12 @@ end !UNPARSE: !$OMP END TARGET !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target !PARSE-TREE: | | OmpClauseList -> !PARSE-TREE: | Block -!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | | | OmpBeginDirective !PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = target data !PARSE-TREE: | | | | OmpClauseList -> OmpClause -> Map -> OmpMapClause @@ -69,7 +69,7 @@ end !UNPARSE: !$OMP END TARGET !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target !PARSE-TREE: | | OmpClauseList -> @@ -108,7 +108,7 @@ end !UNPARSE: !$OMP END TARGET !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target !PARSE-TREE: | | OmpClauseList -> @@ -147,7 +147,7 @@ end !UNPARSE: !$OMP END TARGET !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target !PARSE-TREE: | | OmpClauseList -> diff --git a/flang/test/Parser/OpenMP/declare-reduction-unparse-with-symbols.f90 b/flang/test/Parser/OpenMP/declare-reduction-unparse-with-symbols.f90 new file mode 100644 index 000000000000..fbcd5b62821a --- /dev/null +++ b/flang/test/Parser/OpenMP/declare-reduction-unparse-with-symbols.f90 @@ -0,0 +1,13 @@ +!RUN: %flang_fc1 -fdebug-unparse-with-symbols -fopenmp %s | FileCheck %s + +! This used to crash. + +subroutine f00 + !$omp declare reduction(fred : integer, real : omp_out = omp_in + omp_out) +end + +!CHECK: !DEF: /f00 (Subroutine) Subprogram +!CHECK: subroutine f00 +!CHECK: !$omp declare reduction (fred:integer,real:omp_out = omp_in+omp_out) +!CHECK: end subroutine + diff --git a/flang/test/Parser/OpenMP/do-tile-size.f90 b/flang/test/Parser/OpenMP/do-tile-size.f90 new file mode 100644 index 000000000000..886ee4a2a680 --- /dev/null +++ b/flang/test/Parser/OpenMP/do-tile-size.f90 @@ -0,0 +1,29 @@ +! RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=51 %s | FileCheck --ignore-case %s +! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=51 %s | FileCheck --check-prefix="PARSE-TREE" %s + +subroutine openmp_do_tiles(x) + + integer, intent(inout)::x + + +!CHECK: !$omp do +!CHECK: !$omp tile sizes +!$omp do +!$omp tile sizes(2) +!CHECK: do + do x = 1, 100 + call F1() +!CHECK: end do + end do +!CHECK: !$omp end tile +!$omp end tile +!$omp end do + +!PARSE-TREE:| | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct +!PARSE-TREE:| | | OmpBeginLoopDirective +!PARSE-TREE:| | | OpenMPLoopConstruct +!PARSE-TREE:| | | | OmpBeginLoopDirective +!PARSE-TREE:| | | | | OmpLoopDirective -> llvm::omp::Directive = tile +!PARSE-TREE:| | | | | OmpClauseList -> OmpClause -> Sizes -> Scalar -> Integer -> Expr = '2_4' +!PARSE-TREE: | | | | DoConstruct +END subroutine openmp_do_tiles diff --git a/flang/test/Parser/OpenMP/fail-construct1.f90 b/flang/test/Parser/OpenMP/fail-construct1.f90 index f0b3f7438ae5..2aba50a81e7e 100644 --- a/flang/test/Parser/OpenMP/fail-construct1.f90 +++ b/flang/test/Parser/OpenMP/fail-construct1.f90 @@ -1,5 +1,5 @@ ! RUN: not %flang_fc1 -fsyntax-only -fopenmp %s 2>&1 | FileCheck %s -!$omp parallel -! CHECK: error: expected '!$OMP ' +!$omp parallel +! CHECK: error: Expected OpenMP END PARALLEL directive end diff --git a/flang/test/Parser/OpenMP/in-reduction-clause.f90 b/flang/test/Parser/OpenMP/in-reduction-clause.f90 index ee59069436a2..611068e83900 100644 --- a/flang/test/Parser/OpenMP/in-reduction-clause.f90 +++ b/flang/test/Parser/OpenMP/in-reduction-clause.f90 @@ -28,12 +28,12 @@ subroutine omp_in_reduction_taskgroup() !$omp end taskgroup end subroutine omp_in_reduction_taskgroup -!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE-NEXT: OmpBeginDirective !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = taskgroup !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> TaskReduction -> OmpTaskReductionClause -!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE-NEXT: OmpBeginDirective !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = task !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> InReduction -> OmpInReductionClause @@ -65,7 +65,7 @@ subroutine omp_in_reduction_parallel() !$omp end parallel end subroutine omp_in_reduction_parallel -!PARSE-TREE: OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE-NEXT: OmpBeginDirective !PARSE-TREE-NEXT: OmpDirectiveName -> llvm::omp::Directive = parallel !PARSE-TREE-NEXT: OmpClauseList -> OmpClause -> Reduction -> OmpReductionClause diff --git a/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90 b/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90 index 69a0de656e4d..c2498c878f55 100644 --- a/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90 +++ b/flang/test/Parser/OpenMP/openmp6-directive-spellings.f90 @@ -175,7 +175,7 @@ end !UNPARSE: !$OMP END TARGET_DATA !UNPARSE: END SUBROUTINE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: | OmpBeginDirective !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = target data !PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause diff --git a/flang/test/Parser/OpenMP/ordered-block-vs-standalone.f90 b/flang/test/Parser/OpenMP/ordered-block-vs-standalone.f90 new file mode 100644 index 000000000000..58f1eae07ca6 --- /dev/null +++ b/flang/test/Parser/OpenMP/ordered-block-vs-standalone.f90 @@ -0,0 +1,60 @@ +! RUN: %flang_fc1 -fdebug-dump-parse-tree-no-sema -fopenmp -fopenmp-version=45 %s | FileCheck %s + +! Check that standalone ORDERED is successfully distinguished form block associated ORDERED + +! CHECK: | SubroutineStmt +! CHECK-NEXT: | | Name = 'standalone' +subroutine standalone + integer :: x(10, 10) + do i = 1, 10 + do j = 1,10 + ! CHECK: OpenMPConstruct -> OpenMPStandaloneConstruct + ! CHECK-NEXT: | OmpDirectiveName -> llvm::omp::Directive = ordered + ! CHECK-NEXT: | OmpClauseList -> + ! CHECK-NEXT: | Flags = None + !$omp ordered depend(source) + x(i, j) = i + j + end do + end do +endsubroutine + +! CHECK: | SubroutineStmt +! CHECK-NEXT: | | Name = 'strict_block' +subroutine strict_block + integer :: x(10, 10) + integer :: tmp + do i = 1, 10 + do j = 1,10 + ! CHECK: OpenMPConstruct -> OmpBlockConstruct + ! CHECK-NEXT: | OmpBeginDirective + ! CHECK-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = ordered + ! CHECK-NEXT: | | OmpClauseList -> + ! CHECK-NEXT: | | Flags = None + !$omp ordered + block + tmp = i + j + x(i, j) = tmp + end block + end do + end do +endsubroutine + +! CHECK: | SubroutineStmt +! CHECK-NEXT: | | Name = 'loose_block' +subroutine loose_block + integer :: x(10, 10) + integer :: tmp + do i = 1, 10 + do j = 1,10 + ! CHECK: OpenMPConstruct -> OmpBlockConstruct + ! CHECK-NEXT: | OmpBeginDirective + ! CHECK-NEXT: | | OmpDirectiveName -> llvm::omp::Directive = ordered + ! CHECK-NEXT: | | OmpClauseList -> + ! CHECK-NEXT: | | Flags = None + !$omp ordered + tmp = i + j + x(i, j) = tmp + !$omp end ordered + end do + end do +endsubroutine diff --git a/flang/test/Parser/OpenMP/proc-bind.f90 b/flang/test/Parser/OpenMP/proc-bind.f90 index 98ce39e4db91..849e92683ca6 100644 --- a/flang/test/Parser/OpenMP/proc-bind.f90 +++ b/flang/test/Parser/OpenMP/proc-bind.f90 @@ -3,7 +3,7 @@ ! CHECK: !$OMP PARALLEL PROC_BIND(PRIMARY) -! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +! PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct ! PARSE-TREE: OmpBeginDirective ! PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = parallel ! PARSE-TREE: OmpClauseList -> OmpClause -> ProcBind -> OmpProcBindClause -> AffinityPolicy = Primary diff --git a/flang/test/Parser/OpenMP/scope.f90 b/flang/test/Parser/OpenMP/scope.f90 index 9e046d69f351..610a84ec71d5 100644 --- a/flang/test/Parser/OpenMP/scope.f90 +++ b/flang/test/Parser/OpenMP/scope.f90 @@ -8,7 +8,7 @@ program omp_scope !CHECK: !$OMP SCOPE PRIVATE(i) !CHECK: !$OMP END SCOPE -!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OmpBlockConstruct !PARSE-TREE: OmpBeginDirective !PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = scope !PARSE-TREE: OmpClauseList -> OmpClause -> Private -> OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i' diff --git a/flang/test/Parser/OpenMP/workdistribute.f90 b/flang/test/Parser/OpenMP/workdistribute.f90 new file mode 100644 index 000000000000..09273ab0485c --- /dev/null +++ b/flang/test/Parser/OpenMP/workdistribute.f90 @@ -0,0 +1,27 @@ +!RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=60 %s | FileCheck --ignore-case --check-prefix="UNPARSE" %s +!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=60 %s | FileCheck --check-prefix="PARSE-TREE" %s + +!UNPARSE: SUBROUTINE teams_workdistribute +!UNPARSE: USE :: iso_fortran_env +!UNPARSE: REAL(KIND=4_4) a +!UNPARSE: REAL(KIND=4_4), DIMENSION(10_4) :: x +!UNPARSE: REAL(KIND=4_4), DIMENSION(10_4) :: y +!UNPARSE: !$OMP TEAMS WORKDISTRIBUTE +!UNPARSE: y=a*x+y +!UNPARSE: !$OMP END TEAMS WORKDISTRIBUTE +!UNPARSE: END SUBROUTINE teams_workdistribute + +!PARSE-TREE: | | | OmpBeginDirective +!PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = teams workdistribute +!PARSE-TREE: | | | OmpEndDirective +!PARSE-TREE: | | | | OmpDirectiveName -> llvm::omp::Directive = teams workdistribute + +subroutine teams_workdistribute() + use iso_fortran_env + real(kind=real32) :: a + real(kind=real32), dimension(10) :: x + real(kind=real32), dimension(10) :: y + !$omp teams workdistribute + y = a * x + y + !$omp end teams workdistribute +end subroutine teams_workdistribute |
