97 lines · plain
1! Test the Parse Tree to ensure the OpenMP Loop Transformation Constructs nest correctly with multiple nested loops.2 3! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=51 %s | FileCheck %s --check-prefix=CHECK-PARSE4! RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=51 %s | FileCheck %s --check-prefix=CHECK-UNPARSE5 6subroutine loop_transformation_construct7 implicit none8 integer :: I = 109 integer :: x10 integer :: y(I)11 12 !$omp do13 !$omp unroll partial(1)14 !$omp tile sizes(2)15 do i = 1, I16 y(i) = y(i) * 517 end do18 !$omp end tile19 !$omp end unroll20 !$omp end do21end subroutine22 23!CHECK-PARSE: | ExecutionPart -> Block24!CHECK-PARSE-NEXT: | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct25!CHECK-PARSE-NEXT: | | | OmpBeginLoopDirective26!CHECK-PARSE-NEXT: | | | | OmpDirectiveName -> llvm::omp::Directive = do27!CHECK-PARSE-NEXT: | | | | OmpClauseList ->28!CHECK-PARSE-NEXT: | | | | Flags = {}29!CHECK-PARSE-NEXT: | | | Block30!CHECK-PARSE-NEXT: | | | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct31!CHECK-PARSE-NEXT: | | | | | OmpBeginLoopDirective32!CHECK-PARSE-NEXT: | | | | | | OmpDirectiveName -> llvm::omp::Directive = unroll33!CHECK-PARSE-NEXT: | | | | | | OmpClauseList -> OmpClause -> Partial -> Scalar -> Integer -> Constant -> Expr = '1_4'34!CHECK-PARSE-NEXT: | | | | | | | LiteralConstant -> IntLiteralConstant = '1'35!CHECK-PARSE-NEXT: | | | | | | Flags = {}36!CHECK-PARSE-NEXT: | | | | | Block37!CHECK-PARSE-NEXT: | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct38!CHECK-PARSE-NEXT: | | | | | | | OmpBeginLoopDirective39!CHECK-PARSE-NEXT: | | | | | | | | OmpDirectiveName -> llvm::omp::Directive = tile40!CHECK-PARSE-NEXT: | | | | | | | | OmpClauseList -> OmpClause -> Sizes -> Scalar -> Integer -> Expr = '2_4'41!CHECK-PARSE-NEXT: | | | | | | | | | LiteralConstant -> IntLiteralConstant = '2'42!CHECK-PARSE-NEXT: | | | | | | | | Flags = {}43!CHECK-PARSE-NEXT: | | | | | | | Block44!CHECK-PARSE-NEXT: | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> DoConstruct45!CHECK-PARSE-NEXT: | | | | | | | | | NonLabelDoStmt46!CHECK-PARSE-NEXT: | | | | | | | | | | LoopControl -> LoopBounds47!CHECK-PARSE-NEXT: | | | | | | | | | | | Scalar -> Name = 'i'48!CHECK-PARSE-NEXT: | | | | | | | | | | | Scalar -> Expr = '1_4'49!CHECK-PARSE-NEXT: | | | | | | | | | | | | LiteralConstant -> IntLiteralConstant = '1'50!CHECK-PARSE-NEXT: | | | | | | | | | | | Scalar -> Expr = 'i'51!CHECK-PARSE-NEXT: | | | | | | | | | | | | Designator -> DataRef -> Name = 'i'52!CHECK-PARSE-NEXT: | | | | | | | | | Block53!CHECK-PARSE-NEXT: | | | | | | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'y(int(i,kind=8))=5_4*y(int(i,kind=8))'54!CHECK-PARSE-NEXT: | | | | | | | | | | | Variable = 'y(int(i,kind=8))'55!CHECK-PARSE-NEXT: | | | | | | | | | | | | Designator -> DataRef -> ArrayElement56!CHECK-PARSE-NEXT: | | | | | | | | | | | | | DataRef -> Name = 'y'57!CHECK-PARSE-NEXT: | | | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'i'58!CHECK-PARSE-NEXT: | | | | | | | | | | | | | | Designator -> DataRef -> Name = 'i'59!CHECK-PARSE-NEXT: | | | | | | | | | | | Expr = '5_4*y(int(i,kind=8))'60!CHECK-PARSE-NEXT: | | | | | | | | | | | | Multiply61!CHECK-PARSE-NEXT: | | | | | | | | | | | | | Expr = 'y(int(i,kind=8))'62!CHECK-PARSE-NEXT: | | | | | | | | | | | | | | Designator -> DataRef -> ArrayElement63!CHECK-PARSE-NEXT: | | | | | | | | | | | | | | | DataRef -> Name = 'y'64!CHECK-PARSE-NEXT: | | | | | | | | | | | | | | | SectionSubscript -> Integer -> Expr = 'i'65!CHECK-PARSE-NEXT: | | | | | | | | | | | | | | | | Designator -> DataRef -> Name = 'i'66!CHECK-PARSE-NEXT: | | | | | | | | | | | | | Expr = '5_4'67!CHECK-PARSE-NEXT: | | | | | | | | | | | | | | LiteralConstant -> IntLiteralConstant = '5'68!CHECK-PARSE-NEXT: | | | | | | | | | EndDoStmt ->69!CHECK-PARSE-NEXT: | | | | | | | OmpEndLoopDirective70!CHECK-PARSE-NEXT: | | | | | | | | OmpDirectiveName -> llvm::omp::Directive = tile71!CHECK-PARSE-NEXT: | | | | | | | | OmpClauseList ->72!CHECK-PARSE-NEXT: | | | | | | | | Flags = {}73!CHECK-PARSE-NEXT: | | | | | OmpEndLoopDirective74!CHECK-PARSE-NEXT: | | | | | | OmpDirectiveName -> llvm::omp::Directive = unroll75!CHECK-PARSE-NEXT: | | | | | | OmpClauseList ->76!CHECK-PARSE-NEXT: | | | | | | Flags = {}77!CHECK-PARSE-NEXT: | | | OmpEndLoopDirective78!CHECK-PARSE-NEXT: | | | | OmpDirectiveName -> llvm::omp::Directive = do79!CHECK-PARSE-NEXT: | | | | OmpClauseList ->80!CHECK-PARSE-NEXT: | | | | Flags = {}81 82!CHECK-UNPARSE: SUBROUTINE loop_transformation_construct83!CHECK-UNPARSE-NEXT: IMPLICIT NONE84!CHECK-UNPARSE-NEXT: INTEGER :: i = 10_485!CHECK-UNPARSE-NEXT: INTEGER x86!CHECK-UNPARSE-NEXT: INTEGER y(i)87!CHECK-UNPARSE-NEXT: !$OMP DO88!CHECK-UNPARSE-NEXT: !$OMP UNROLL PARTIAL(1_4)89!CHECK-UNPARSE-NEXT: !$OMP TILE90!CHECK-UNPARSE-NEXT: DO i=1_4,i91!CHECK-UNPARSE-NEXT: y(int(i,kind=8))=5_4*y(int(i,kind=8))92!CHECK-UNPARSE-NEXT: END DO93!CHECK-UNPARSE-NEXT: !$OMP END TILE94!CHECK-UNPARSE-NEXT: !$OMP END UNROLL95!CHECK-UNPARSE-NEXT: !$OMP END DO96!CHECK-UNPARSE-NEXT: END SUBROUTINE97