|
| 1 | +! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case %s |
| 2 | +! RUN: %flang_fc1 -fdebug-dump-parse-tree-no-sema -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s |
| 3 | + |
| 4 | +subroutine sub0 |
| 5 | +!CHECK: !$OMP DECLARE VARIANT (sub:vsub) MATCH(CONSTRUCT={PARALLEL}) |
| 6 | +!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective |
| 7 | +!PARSE-TREE: | Verbatim |
| 8 | +!PARSE-TREE: | Name = 'sub' |
| 9 | +!PARSE-TREE: | Name = 'vsub' |
| 10 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector |
| 11 | +!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct |
| 12 | +!PARSE-TREE: | | OmpTraitSelector |
| 13 | +!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = parallel |
| 14 | + !$omp declare variant (sub:vsub) match (construct={parallel}) |
| 15 | +contains |
| 16 | + subroutine vsub |
| 17 | + end subroutine |
| 18 | + |
| 19 | + subroutine sub () |
| 20 | + end subroutine |
| 21 | +end subroutine |
| 22 | + |
| 23 | +subroutine sb1 |
| 24 | + integer :: x |
| 25 | + x = 1 |
| 26 | + !$omp dispatch device(1) |
| 27 | + call sub(x) |
| 28 | +contains |
| 29 | + subroutine vsub (v1) |
| 30 | + integer, value :: v1 |
| 31 | + end |
| 32 | + subroutine sub (v1) |
| 33 | +!CHECK: !$OMP DECLARE VARIANT (vsub) MATCH(CONSTRUCT={DISPATCH} |
| 34 | +!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective |
| 35 | +!PARSE-TREE: | Verbatim |
| 36 | +!PARSE-TREE: | Name = 'vsub' |
| 37 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector |
| 38 | +!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct |
| 39 | +!PARSE-TREE: | | OmpTraitSelector |
| 40 | +!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = dispatch |
| 41 | + !$omp declare variant(vsub), match(construct={dispatch}) |
| 42 | + integer, value :: v1 |
| 43 | + end |
| 44 | +end subroutine |
| 45 | + |
| 46 | +subroutine sb2 (x1, x2) |
| 47 | + use omp_lib, only: omp_interop_kind |
| 48 | + integer :: x |
| 49 | + x = 1 |
| 50 | + !$omp dispatch device(1) |
| 51 | + call sub(x) |
| 52 | +contains |
| 53 | + subroutine vsub (v1, a1, a2) |
| 54 | + integer, value :: v1 |
| 55 | + integer(omp_interop_kind) :: a1 |
| 56 | + integer(omp_interop_kind), value :: a2 |
| 57 | + end |
| 58 | + subroutine sub (v1) |
| 59 | +!CHECK: !$OMP DECLARE VARIANT (vsub) MATCH(CONSTRUCT={DISPATCH}) APPEND_ARGS(INTEROP(T& |
| 60 | +!CHECK: !$OMP&ARGET),INTEROP(TARGET)) |
| 61 | +!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective |
| 62 | +!PARSE-TREE: | Verbatim |
| 63 | +!PARSE-TREE: | Name = 'vsub' |
| 64 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector |
| 65 | +!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct |
| 66 | +!PARSE-TREE: | | OmpTraitSelector |
| 67 | +!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = dispatch |
| 68 | +!PARSE-TREE: | OmpClause -> AppendArgs -> OmpAppendArgsClause -> OmpAppendOp -> OmpInteropType -> Value = Target |
| 69 | +!PARSE-TREE: | OmpAppendOp -> OmpInteropType -> Value = Target |
| 70 | + !$omp declare variant(vsub), match(construct={dispatch}), append_args (interop(target), interop(target)) |
| 71 | + integer, value :: v1 |
| 72 | + end |
| 73 | +end subroutine |
| 74 | + |
| 75 | +subroutine sb3 (x1, x2) |
| 76 | + use iso_c_binding, only: c_ptr |
| 77 | + type(c_ptr), value :: x1, x2 |
| 78 | + |
| 79 | + !$omp dispatch device(1) |
| 80 | + call sub(x1, x2) |
| 81 | +contains |
| 82 | + subroutine sub (v1, v2) |
| 83 | + type(c_ptr), value :: v1, v2 |
| 84 | +!CHECK: !$OMP DECLARE VARIANT (vsub) MATCH(CONSTRUCT={DISPATCH}) ADJUST_ARGS(NOTHING:v& |
| 85 | +!CHECK: !$OMP&1) ADJUST_ARGS(NEED_DEVICE_PTR:v2) |
| 86 | +!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective |
| 87 | +!PARSE-TREE: | Verbatim |
| 88 | +!PARSE-TREE: | Name = 'vsub' |
| 89 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector |
| 90 | +!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = Construct |
| 91 | +!PARSE-TREE: | | OmpTraitSelector |
| 92 | +!PARSE-TREE: | | | OmpTraitSelectorName -> llvm::omp::Directive = dispatch |
| 93 | +!PARSE-TREE: | OmpClause -> AdjustArgs -> OmpAdjustArgsClause |
| 94 | +!PARSE-TREE: | | OmpAdjustOp -> Value = Nothing |
| 95 | +!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'v1' |
| 96 | +!PARSE-TREE: | OmpClause -> AdjustArgs -> OmpAdjustArgsClause |
| 97 | +!PARSE-TREE: | | OmpAdjustOp -> Value = Need_Device_Ptr |
| 98 | +!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'v2' |
| 99 | + !$omp declare variant(vsub) match ( construct = { dispatch } ) adjust_args(nothing : v1 ) adjust_args(need_device_ptr : v2) |
| 100 | + end |
| 101 | + subroutine vsub(v1, v2) |
| 102 | + type(c_ptr), value :: v1, v2 |
| 103 | + end |
| 104 | +end subroutine |
0 commit comments