147 lines · plain
1! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case %s2! RUN: %flang_fc1 -fdebug-dump-parse-tree-no-sema -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s3 4subroutine sub05!CHECK: !$OMP DECLARE VARIANT(sub:vsub) MATCH(CONSTRUCT={PARALLEL})6 7!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective -> OmpDirectiveSpecification8!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare variant9!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpBaseVariantNames10!PARSE-TREE: | | OmpObject -> Designator -> DataRef -> Name = 'sub'11!PARSE-TREE: | | OmpObject -> Designator -> DataRef -> Name = 'vsub'12!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector13!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct14!PARSE-TREE: | | OmpTraitSelector15!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = parallel16!PARSE-TREE: | Flags = {}17 18 !$omp declare variant (sub:vsub) match (construct={parallel})19contains20 subroutine vsub21 end subroutine22 23 subroutine sub ()24 end subroutine25end subroutine26 27subroutine sb128 integer :: x29 x = 130 !$omp dispatch device(1)31 call sub(x)32contains33 subroutine vsub (v1)34 integer, value :: v135 end36 subroutine sub (v1)37!CHECK: !$OMP DECLARE VARIANT(vsub) MATCH(CONSTRUCT={DISPATCH})38 39!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective -> OmpDirectiveSpecification40!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare variant41!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'vsub'42!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector43!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct44!PARSE-TREE: | | OmpTraitSelector45!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = dispatch46!PARSE-TREE: | Flags = {}47 48 !$omp declare variant(vsub), match(construct={dispatch})49 integer, value :: v150 end51end subroutine52 53subroutine sb2 (x1, x2)54 use omp_lib, only: omp_interop_kind55 integer :: x56 x = 157 !$omp dispatch device(1)58 call sub(x)59contains60 subroutine vsub (v1, a1, a2)61 integer, value :: v162 integer(omp_interop_kind) :: a163 integer(omp_interop_kind), value :: a264 end65 subroutine sub (v1)66!CHECK: !$OMP DECLARE VARIANT(vsub) MATCH(CONSTRUCT={DISPATCH}) APPEND_ARGS(INTEROP(TA&67!CHECK: !$OMP&RGET),INTEROP(TARGET))68 69!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective -> OmpDirectiveSpecification70!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare variant71!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'vsub'72!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector73!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct74!PARSE-TREE: | | OmpTraitSelector75!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = dispatch76!PARSE-TREE: | OmpClause -> AppendArgs -> OmpAppendArgsClause -> OmpAppendOp -> OmpInteropType -> Value = Target77!PARSE-TREE: | OmpAppendOp -> OmpInteropType -> Value = Target78!PARSE-TREE: | Flags = {}79 80 !$omp declare variant(vsub), match(construct={dispatch}), append_args (interop(target), interop(target))81 integer, value :: v182 end83end subroutine84 85subroutine sb3 (x1, x2)86 use iso_c_binding, only: c_ptr87 type(c_ptr), value :: x1, x288 89 !$omp dispatch device(1)90 call sub(x1, x2)91contains92 subroutine sub (v1, v2)93 type(c_ptr), value :: v1, v294!CHECK: !$OMP DECLARE VARIANT(vsub) MATCH(CONSTRUCT={DISPATCH}) ADJUST_ARGS(NOTHING:v1&95!CHECK: !$OMP&) ADJUST_ARGS(NEED_DEVICE_PTR:v2)96 97!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective -> OmpDirectiveSpecification98!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare variant99!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'vsub'100!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector101!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct102!PARSE-TREE: | | OmpTraitSelector103!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = dispatch104!PARSE-TREE: | OmpClause -> AdjustArgs -> OmpAdjustArgsClause105!PARSE-TREE: | | OmpAdjustOp -> Value = Nothing106!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'v1'107!PARSE-TREE: | OmpClause -> AdjustArgs -> OmpAdjustArgsClause108!PARSE-TREE: | | OmpAdjustOp -> Value = Need_Device_Ptr109!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'v2'110!PARSE-TREE: | Flags = {}111 112 !$omp declare variant(vsub) match ( construct = { dispatch } ) adjust_args(nothing : v1 ) adjust_args(need_device_ptr : v2)113 end114 subroutine vsub(v1, v2)115 type(c_ptr), value :: v1, v2116 end117end subroutine118 119subroutine f120 real :: x, y121 y = 2122 !omp simd123 call f2(x, y)124 !omp end simd 125contains126 subroutine f1 (x, y)127 real :: x, y128 end129 130 subroutine f2 (x, y)131 real :: x, y132 !$omp declare variant (f1) match (construct={simd(uniform(y))})133 end134end subroutine135!CHECK: !$OMP DECLARE VARIANT(f1) MATCH(CONSTRUCT={SIMD(UNIFORM(y))})136 137!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective -> OmpDirectiveSpecification138!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = declare variant139!PARSE-TREE: | OmpArgumentList -> OmpArgument -> OmpLocator -> OmpObject -> Designator -> DataRef -> Name = 'f1'140!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector141!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct142!PARSE-TREE: | | OmpTraitSelector143!PARSE-TREE: | | | OmpTraitSelectorName -> Value = Simd144!PARSE-TREE: | | | Properties145!PARSE-TREE: | | | | OmpTraitProperty -> OmpClause -> Uniform -> Name = 'y'146!PARSE-TREE: | Flags = {}147