291 lines · plain
1!RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=60 %s | FileCheck --ignore-case --check-prefix="UNPARSE" %s2!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=60 %s | FileCheck --check-prefix="PARSE-TREE" %s3 4subroutine f00(a, b)5 integer :: a, b6 integer :: x7 !$omp atomic update compare8 if (x < a) x = b9end10 11!UNPARSE: SUBROUTINE f00 (a, b)12!UNPARSE: INTEGER a, b13!UNPARSE: INTEGER x14!UNPARSE: !$OMP ATOMIC UPDATE COMPARE15!UNPARSE: IF (x<a) x=b16!UNPARSE: END SUBROUTINE17 18!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct19!PARSE-TREE: | OmpBeginDirective20!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic21!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->22!PARSE-TREE: | | OmpClause -> Compare23!PARSE-TREE: | | Flags = {}24!PARSE-TREE: | Block25!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> IfStmt26!PARSE-TREE: | | | Scalar -> Logical -> Expr = 'x<a'27!PARSE-TREE: | | | | LT28!PARSE-TREE: | | | | | Expr = 'x'29!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'30!PARSE-TREE: | | | | | Expr = 'a'31!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'a'32!PARSE-TREE: | | | ActionStmt -> AssignmentStmt = 'x=b'33!PARSE-TREE: | | | | Variable = 'x'34!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'x'35!PARSE-TREE: | | | | Expr = 'b'36!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'b'37 38subroutine f01(a, b)39 integer :: a, b40 integer :: x41 !$omp atomic update compare42 if (x < a) then43 x = b44 endif45end46 47!UNPARSE: SUBROUTINE f01 (a, b)48!UNPARSE: INTEGER a, b49!UNPARSE: INTEGER x50!UNPARSE: !$OMP ATOMIC UPDATE COMPARE51!UNPARSE: IF (x<a) THEN52!UNPARSE: x=b53!UNPARSE: END IF54!UNPARSE: END SUBROUTINE55 56!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct57!PARSE-TREE: | OmpBeginDirective58!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic59!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->60!PARSE-TREE: | | OmpClause -> Compare61!PARSE-TREE: | | Flags = {}62!PARSE-TREE: | Block63!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> IfConstruct64!PARSE-TREE: | | | IfThenStmt65!PARSE-TREE: | | | | Scalar -> Logical -> Expr = 'x<a'66!PARSE-TREE: | | | | | LT67!PARSE-TREE: | | | | | | Expr = 'x'68!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'x'69!PARSE-TREE: | | | | | | Expr = 'a'70!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'a'71!PARSE-TREE: | | | Block72!PARSE-TREE: | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'x=b'73!PARSE-TREE: | | | | | Variable = 'x'74!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'75!PARSE-TREE: | | | | | Expr = 'b'76!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'b'77!PARSE-TREE: | | | EndIfStmt ->78 79subroutine f02(a, b)80 integer :: a, b81 integer :: x82 logical :: c83 c = x < a84 !$omp atomic update compare85 if (c) then86 x = b87 endif88end89 90!UNPARSE: SUBROUTINE f02 (a, b)91!UNPARSE: INTEGER a, b92!UNPARSE: INTEGER x93!UNPARSE: LOGICAL c94!UNPARSE: c=x<a95!UNPARSE: !$OMP ATOMIC UPDATE COMPARE96!UNPARSE: IF (c) THEN97!UNPARSE: x=b98!UNPARSE: END IF99!UNPARSE: END SUBROUTINE100 101!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'c=x<a'102!PARSE-TREE: | Variable = 'c'103!PARSE-TREE: | | Designator -> DataRef -> Name = 'c'104!PARSE-TREE: | Expr = 'x<a'105!PARSE-TREE: | | LT106!PARSE-TREE: | | | Expr = 'x'107!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x'108!PARSE-TREE: | | | Expr = 'a'109!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'a'110!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct111!PARSE-TREE: | OmpBeginDirective112!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic113!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->114!PARSE-TREE: | | OmpClause -> Compare115!PARSE-TREE: | | Flags = {}116!PARSE-TREE: | Block117!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> IfConstruct118!PARSE-TREE: | | | IfThenStmt119!PARSE-TREE: | | | | Scalar -> Logical -> Expr = 'c'120!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'c'121!PARSE-TREE: | | | Block122!PARSE-TREE: | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'x=b'123!PARSE-TREE: | | | | | Variable = 'x'124!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'125!PARSE-TREE: | | | | | Expr = 'b'126!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'b'127!PARSE-TREE: | | | EndIfStmt ->128 129subroutine g00(a, b)130 integer :: a, b131 integer :: x, v132 !$omp atomic update capture compare133 v = x134 if (x < a) x = b135 !$omp end atomic136end137 138!UNPARSE: SUBROUTINE g00 (a, b)139!UNPARSE: INTEGER a, b140!UNPARSE: INTEGER x, v141!UNPARSE: !$OMP ATOMIC UPDATE CAPTURE COMPARE142!UNPARSE: v=x143!UNPARSE: IF (x<a) x=b144!UNPARSE: !$OMP END ATOMIC145!UNPARSE: END SUBROUTINE146 147!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct148!PARSE-TREE: | OmpBeginDirective149!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic150!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->151!PARSE-TREE: | | OmpClause -> Capture152!PARSE-TREE: | | OmpClause -> Compare153!PARSE-TREE: | | Flags = {}154!PARSE-TREE: | Block155!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'v=x'156!PARSE-TREE: | | | Variable = 'v'157!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v'158!PARSE-TREE: | | | Expr = 'x'159!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x'160!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> IfStmt161!PARSE-TREE: | | | Scalar -> Logical -> Expr = 'x<a'162!PARSE-TREE: | | | | LT163!PARSE-TREE: | | | | | Expr = 'x'164!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'165!PARSE-TREE: | | | | | Expr = 'a'166!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'a'167!PARSE-TREE: | | | ActionStmt -> AssignmentStmt = 'x=b'168!PARSE-TREE: | | | | Variable = 'x'169!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'x'170!PARSE-TREE: | | | | Expr = 'b'171!PARSE-TREE: | | | | | Designator -> DataRef -> Name = 'b'172!PARSE-TREE: | OmpEndDirective173!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic174!PARSE-TREE: | | OmpClauseList ->175!PARSE-TREE: | | Flags = {}176 177subroutine g01(a, b)178 integer :: a, b179 integer :: x, v180 !$omp atomic update capture compare181 v = x182 if (x < a) then183 x = b184 endif185 !$omp end atomic186end187 188!UNPARSE: SUBROUTINE g01 (a, b)189!UNPARSE: INTEGER a, b190!UNPARSE: INTEGER x, v191!UNPARSE: !$OMP ATOMIC UPDATE CAPTURE COMPARE192!UNPARSE: v=x193!UNPARSE: IF (x<a) THEN194!UNPARSE: x=b195!UNPARSE: END IF196!UNPARSE: !$OMP END ATOMIC197!UNPARSE: END SUBROUTINE198 199!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct200!PARSE-TREE: | OmpBeginDirective201!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic202!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->203!PARSE-TREE: | | OmpClause -> Capture204!PARSE-TREE: | | OmpClause -> Compare205!PARSE-TREE: | | Flags = {}206!PARSE-TREE: | Block207!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'v=x'208!PARSE-TREE: | | | Variable = 'v'209!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'v'210!PARSE-TREE: | | | Expr = 'x'211!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'x'212!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> IfConstruct213!PARSE-TREE: | | | IfThenStmt214!PARSE-TREE: | | | | Scalar -> Logical -> Expr = 'x<a'215!PARSE-TREE: | | | | | LT216!PARSE-TREE: | | | | | | Expr = 'x'217!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'x'218!PARSE-TREE: | | | | | | Expr = 'a'219!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'a'220!PARSE-TREE: | | | Block221!PARSE-TREE: | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'x=b'222!PARSE-TREE: | | | | | Variable = 'x'223!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'224!PARSE-TREE: | | | | | Expr = 'b'225!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'b'226!PARSE-TREE: | | | EndIfStmt ->227!PARSE-TREE: | OmpEndDirective228!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic229!PARSE-TREE: | | OmpClauseList ->230!PARSE-TREE: | | Flags = {}231 232subroutine g02(a, b)233 integer :: a, b234 integer :: x, v235 !$omp atomic update capture compare236 if (x < a) then237 x = b238 else239 v = x240 endif241 !$omp end atomic242end243 244!UNPARSE: SUBROUTINE g02 (a, b)245!UNPARSE: INTEGER a, b246!UNPARSE: INTEGER x, v247!UNPARSE: !$OMP ATOMIC UPDATE CAPTURE COMPARE248!UNPARSE: IF (x<a) THEN249!UNPARSE: x=b250!UNPARSE: ELSE251!UNPARSE: v=x252!UNPARSE: END IF253!UNPARSE: !$OMP END ATOMIC254!UNPARSE: END SUBROUTINE255 256!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAtomicConstruct257!PARSE-TREE: | OmpBeginDirective258!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic259!PARSE-TREE: | | OmpClauseList -> OmpClause -> Update ->260!PARSE-TREE: | | OmpClause -> Capture261!PARSE-TREE: | | OmpClause -> Compare262!PARSE-TREE: | | Flags = {}263!PARSE-TREE: | Block264!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> IfConstruct265!PARSE-TREE: | | | IfThenStmt266!PARSE-TREE: | | | | Scalar -> Logical -> Expr = 'x<a'267!PARSE-TREE: | | | | | LT268!PARSE-TREE: | | | | | | Expr = 'x'269!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'x'270!PARSE-TREE: | | | | | | Expr = 'a'271!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'a'272!PARSE-TREE: | | | Block273!PARSE-TREE: | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'x=b'274!PARSE-TREE: | | | | | Variable = 'x'275!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'x'276!PARSE-TREE: | | | | | Expr = 'b'277!PARSE-TREE: | | | | | | Designator -> DataRef -> Name = 'b'278!PARSE-TREE: | | | ElseBlock279!PARSE-TREE: | | | | ElseStmt ->280!PARSE-TREE: | | | | Block281!PARSE-TREE: | | | | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'v=x'282!PARSE-TREE: | | | | | | Variable = 'v'283!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'v'284!PARSE-TREE: | | | | | | Expr = 'x'285!PARSE-TREE: | | | | | | | Designator -> DataRef -> Name = 'x'286!PARSE-TREE: | | | EndIfStmt ->287!PARSE-TREE: | OmpEndDirective288!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = atomic289!PARSE-TREE: | | OmpClauseList ->290!PARSE-TREE: | | Flags = {}291