182 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %flang_fc1 -fdebug-unparse-no-sema %openmp_flags %s | FileCheck --ignore-case %s4! RUN: %flang_fc1 -fdebug-dump-parse-tree %openmp_flags %s | FileCheck --check-prefix="PARSE-TREE" %s5! Checks the parsing of Openmp 5.0 Target Device constructs6!7PROGRAM main8 USE OMP_LIB9 IMPLICIT NONE10 INTEGER :: X, Y11 INTEGER :: M = 112 13 14!------------------------------------------------------15! Check Device clause with a constant argument16!------------------------------------------------------17!CHECK: !$OMP TARGET DEVICE(1)18!$OMP TARGET DEVICE(1)19 M = M + 120!CHECK: !$OMP END TARGET21!$OMP END TARGET22 23!PARSE-TREE: OmpBeginDirective24!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target25!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause26!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'27!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'28!PARSE-TREE: OmpEndDirective29!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target30!PARSE-TREE: OmpClauseList ->31 32!------------------------------------------------------33! Check Device clause with a constant integer expression argument34!------------------------------------------------------35!CHECK: !$OMP TARGET DEVICE(2-1)36!$OMP TARGET DEVICE(2-1)37 M = M + 138!CHECK: !$OMP END TARGET39!$OMP END TARGET40 41!PARSE-TREE: OmpBeginDirective42!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target43!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause44!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'45!PARSE-TREE: Subtract46!PARSE-TREE: Expr = '2_4'47!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'48!PARSE-TREE: Expr = '1_4'49!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'50!PARSE-TREE: OmpEndDirective51!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target52!PARSE-TREE: OmpClauseList ->53 54 55!------------------------------------------------------56! Check Device clause with a variable argument57!------------------------------------------------------58!CHECK: !$OMP TARGET DEVICE(X)59!$OMP TARGET DEVICE(X)60 M = M + 161!CHECK: !$OMP END TARGET62!$OMP END TARGET63 64!PARSE-TREE: OmpBeginDirective65!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target66!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause67!PARSE-TREE: Scalar -> Integer -> Expr = 'x'68!PARSE-TREE: Designator -> DataRef -> Name = 'x'69!PARSE-TREE: OmpEndDirective70!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target71!PARSE-TREE: OmpClauseList ->72 73 74!------------------------------------------------------75! Check Device clause with an variable integer expression76!------------------------------------------------------77!CHECK: !$OMP TARGET DEVICE(X+Y)78!$OMP TARGET DEVICE(X+Y)79 M = M + 180!CHECK: !$OMP END TARGET81!$OMP END TARGET82 83!PARSE-TREE: OmpBeginDirective84!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target85!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause86!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'87!PARSE-TREE: Add88!PARSE-TREE: Expr = 'x'89!PARSE-TREE: Designator -> DataRef -> Name = 'x'90!PARSE-TREE: Expr = 'y'91!PARSE-TREE: Designator -> DataRef -> Name = 'y'92!PARSE-TREE: OmpEndDirective93!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target94!PARSE-TREE: OmpClauseList ->95 96!------------------------------------------------------97! Check Device Ancestor clause with a constant argument98!------------------------------------------------------99!CHECK: !$OMP TARGET DEVICE(ANCESTOR: 1)100!$OMP TARGET DEVICE(ANCESTOR: 1)101 M = M + 1102!CHECK: !$OMP END TARGET103!$OMP END TARGET104 105!PARSE-TREE: OmpBeginDirective106!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target107!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause108!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor109!PARSE-TREE: Scalar -> Integer -> Expr = '1_4'110!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'111!PARSE-TREE: OmpEndDirective112!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target113!PARSE-TREE: OmpClauseList ->114 115 116!--------------------------------------------------------117! Check Device Devive-Num clause with a constant argument118!--------------------------------------------------------119!CHECK: !$OMP TARGET DEVICE(DEVICE_NUM: 2)120!$OMP TARGET DEVICE(DEVICE_NUM: 2)121 M = M + 1122!CHECK: !$OMP END TARGET123!$OMP END TARGET124 125!PARSE-TREE: OmpBeginDirective126!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target127!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause128!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num129!PARSE-TREE: Scalar -> Integer -> Expr = '2_4'130!PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'131!PARSE-TREE: OmpEndDirective132!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target133!PARSE-TREE: OmpClauseList ->134 135 136!-------------------------------------------------------------------137! Check Device Ancestor clause with a variable expression argument138!-------------------------------------------------------------------139!CHECK: !$OMP TARGET DEVICE(ANCESTOR: X+Y)140!$OMP TARGET DEVICE(ANCESTOR: X + Y)141 M = M + 1142!CHECK: !$OMP END TARGET143!$OMP END TARGET144 145!PARSE-TREE: OmpBeginDirective146!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target147!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause148!PARSE-TREE: OmpDeviceModifier -> Value = Ancestor149!PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'150!PARSE-TREE: Add151!PARSE-TREE: Expr = 'x'152!PARSE-TREE: Designator -> DataRef -> Name = 'x'153!PARSE-TREE: Expr = 'y'154!PARSE-TREE: Designator -> DataRef -> Name = 'y'155!PARSE-TREE: OmpEndDirective156!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target157!PARSE-TREE: OmpClauseList ->158 159 160!-------------------------------------------------------------------161! Check Device Devive-Num clause with a variable expression argument162!-------------------------------------------------------------------163!CHECK: !$OMP TARGET DEVICE(DEVICE_NUM: X-Y)164!$OMP TARGET DEVICE(DEVICE_NUM: X - Y)165 M = M + 1166!CHECK: !$OMP END TARGET167!$OMP END TARGET168 169!PARSE-TREE: OmpBeginDirective170!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target171!PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause172!PARSE-TREE: OmpDeviceModifier -> Value = Device_Num173!PARSE-TREE: Scalar -> Integer -> Expr = 'x-y'174!PARSE-TREE: Subtract175!PARSE-TREE: Expr = 'x'176!PARSE-TREE: Designator -> DataRef -> Name = 'x'177!PARSE-TREE: Expr = 'y'178!PARSE-TREE: Designator -> DataRef -> Name = 'y'179!PARSE-TREE: OmpEndDirective180!PARSE-TREE: OmpDirectiveName -> llvm::omp::Directive = target181END PROGRAM182