|
| 1 | +!RUN: %flang_fc1 -fdebug-unparse -fopenmp -fopenmp-version=60 %s -o - | FileCheck --check-prefix=UNPARSE %s |
| 2 | +!RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=60 %s -o - | FileCheck --check-prefix=PARSE-TREE %s |
| 3 | + |
| 4 | +! The directives to check: |
| 5 | +! cancellation_point |
| 6 | +! declare_mapper |
| 7 | +! declare_reduction |
| 8 | +! declare_simd |
| 9 | +! declare_target |
| 10 | +! declare_variant |
| 11 | +! target_data |
| 12 | +! target_enter_data |
| 13 | +! target_exit_data |
| 14 | +! target_update |
| 15 | + |
| 16 | +subroutine f00 |
| 17 | + implicit none |
| 18 | + integer :: i |
| 19 | + |
| 20 | + !$omp parallel |
| 21 | + do i = 1, 10 |
| 22 | + !$omp cancellation_point parallel |
| 23 | + enddo |
| 24 | + !$omp end parallel |
| 25 | +end |
| 26 | + |
| 27 | +!UNPARSE: SUBROUTINE f00 |
| 28 | +!UNPARSE: IMPLICIT NONE |
| 29 | +!UNPARSE: INTEGER i |
| 30 | +!UNPARSE: !$OMP PARALLEL |
| 31 | +!UNPARSE: DO i=1_4,10_4 |
| 32 | +!UNPARSE: !$OMP CANCELLATION_POINT PARALLEL |
| 33 | +!UNPARSE: END DO |
| 34 | +!UNPARSE: !$OMP END PARALLEL |
| 35 | +!UNPARSE: END SUBROUTINE |
| 36 | + |
| 37 | +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPCancellationPointConstruct -> OmpDirectiveSpecification |
| 38 | +!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = cancellation point |
| 39 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> CancellationConstructType -> OmpCancellationConstructTypeClause |
| 40 | +!PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = parallel |
| 41 | +!PARSE-TREE: | Flags = None |
| 42 | + |
| 43 | +subroutine f01 |
| 44 | + type :: t |
| 45 | + integer :: x |
| 46 | + end type |
| 47 | + !$omp declare_mapper(t :: v) map(v%x) |
| 48 | +end |
| 49 | + |
| 50 | +!UNPARSE: SUBROUTINE f01 |
| 51 | +!UNPARSE: TYPE :: t |
| 52 | +!UNPARSE: INTEGER :: x |
| 53 | +!UNPARSE: END TYPE |
| 54 | +!UNPARSE: !$OMP DECLARE MAPPER (t::v) MAP(v%x) |
| 55 | +!UNPARSE: END SUBROUTINE |
| 56 | + |
| 57 | +!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareMapperConstruct |
| 58 | +!PARSE-TREE: | Verbatim |
| 59 | +!PARSE-TREE: | OmpMapperSpecifier |
| 60 | +!PARSE-TREE: | | string = 't.omp.default.mapper' |
| 61 | +!PARSE-TREE: | | TypeSpec -> DerivedTypeSpec |
| 62 | +!PARSE-TREE: | | | Name = 't' |
| 63 | +!PARSE-TREE: | | Name = 'v' |
| 64 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause |
| 65 | +!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> StructureComponent |
| 66 | +!PARSE-TREE: | | | DataRef -> Name = 'v' |
| 67 | +!PARSE-TREE: | | | Name = 'x' |
| 68 | +!PARSE-TREE: | | bool = 'true' |
| 69 | + |
| 70 | +subroutine f02 |
| 71 | + type :: t |
| 72 | + integer :: x |
| 73 | + end type |
| 74 | + !$omp declare_reduction(+ : t : omp_out%x = omp_out%x + omp_in%x) |
| 75 | +end |
| 76 | + |
| 77 | +!UNPARSE: SUBROUTINE f02 |
| 78 | +!UNPARSE: TYPE :: t |
| 79 | +!UNPARSE: INTEGER :: x |
| 80 | +!UNPARSE: END TYPE |
| 81 | +!UNPARSE: !$OMP DECLARE REDUCTION (+:t: omp_out%x=omp_out%x+omp_in%x |
| 82 | +!UNPARSE: ) |
| 83 | +!UNPARSE: END SUBROUTINE |
| 84 | + |
| 85 | +!PARSE-TREE: DeclarationConstruct -> SpecificationConstruct -> OpenMPDeclarativeConstruct -> OpenMPDeclareReductionConstruct |
| 86 | +!PARSE-TREE: | Verbatim |
| 87 | +!PARSE-TREE: | OmpReductionSpecifier |
| 88 | +!PARSE-TREE: | | OmpReductionIdentifier -> DefinedOperator -> IntrinsicOperator = Add |
| 89 | +!PARSE-TREE: | | OmpTypeNameList -> OmpTypeSpecifier -> TypeSpec -> DerivedTypeSpec |
| 90 | +!PARSE-TREE: | | | Name = 't' |
| 91 | +!PARSE-TREE: | | OmpReductionCombiner -> AssignmentStmt = 'omp_out%x=omp_out%x+omp_in%x' |
| 92 | +!PARSE-TREE: | | | Variable = 'omp_out%x' |
| 93 | +!PARSE-TREE: | | | | Designator -> DataRef -> StructureComponent |
| 94 | +!PARSE-TREE: | | | | | DataRef -> Name = 'omp_out' |
| 95 | +!PARSE-TREE: | | | | | Name = 'x' |
| 96 | +!PARSE-TREE: | | | Expr = 'omp_out%x+omp_in%x' |
| 97 | +!PARSE-TREE: | | | | Add |
| 98 | +!PARSE-TREE: | | | | | Expr = 'omp_out%x' |
| 99 | +!PARSE-TREE: | | | | | | Designator -> DataRef -> StructureComponent |
| 100 | +!PARSE-TREE: | | | | | | | DataRef -> Name = 'omp_out' |
| 101 | +!PARSE-TREE: | | | | | | | Name = 'x' |
| 102 | +!PARSE-TREE: | | | | | Expr = 'omp_in%x' |
| 103 | +!PARSE-TREE: | | | | | | Designator -> DataRef -> StructureComponent |
| 104 | +!PARSE-TREE: | | | | | | | DataRef -> Name = 'omp_in' |
| 105 | +!PARSE-TREE: | | | | | | | Name = 'x' |
| 106 | +!PARSE-TREE: | OmpClauseList -> |
| 107 | + |
| 108 | +subroutine f03 |
| 109 | + !$omp declare_simd |
| 110 | +end |
| 111 | + |
| 112 | +!UNPARSE: SUBROUTINE f03 |
| 113 | +!UNPARSE: !$OMP DECLARE SIMD |
| 114 | +!UNPARSE: END SUBROUTINE |
| 115 | + |
| 116 | +!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclareSimdConstruct |
| 117 | +!PARSE-TREE: | Verbatim |
| 118 | +!PARSE-TREE: | OmpClauseList -> |
| 119 | + |
| 120 | +subroutine f04 |
| 121 | + !$omp declare_target |
| 122 | +end |
| 123 | + |
| 124 | +!UNPARSE: SUBROUTINE f04 |
| 125 | +!UNPARSE: !$OMP DECLARE TARGET |
| 126 | +!UNPARSE: END SUBROUTINE |
| 127 | + |
| 128 | +!PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclareTargetConstruct |
| 129 | +!PARSE-TREE: | Verbatim |
| 130 | +!PARSE-TREE: | OmpDeclareTargetSpecifier -> OmpDeclareTargetWithClause -> OmpClauseList -> |
| 131 | + |
| 132 | +subroutine f05 |
| 133 | + implicit none |
| 134 | + interface |
| 135 | + subroutine g05 |
| 136 | + end |
| 137 | + end interface |
| 138 | + !$omp declare_variant(g05) match(user={condition(.true.)}) |
| 139 | +end |
| 140 | + |
| 141 | +!UNPARSE: SUBROUTINE f05 |
| 142 | +!UNPARSE: IMPLICIT NONE |
| 143 | +!UNPARSE: INTERFACE |
| 144 | +!UNPARSE: SUBROUTINE g05 |
| 145 | +!UNPARSE: END SUBROUTINE |
| 146 | +!UNPARSE: END INTERFACE |
| 147 | +!UNPARSE: !$OMP DECLARE VARIANT (g05) MATCH(USER={CONDITION(.true._4)}) |
| 148 | +!UNPARSE: END SUBROUTINE |
| 149 | + |
| 150 | +!PARSE-TREE: OpenMPDeclarativeConstruct -> OmpDeclareVariantDirective |
| 151 | +!PARSE-TREE: | Verbatim |
| 152 | +!PARSE-TREE: | Name = 'g05' |
| 153 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Match -> OmpMatchClause -> OmpContextSelectorSpecification -> OmpTraitSetSelector |
| 154 | +!PARSE-TREE: | | OmpTraitSetSelectorName -> Value = User |
| 155 | +!PARSE-TREE: | | OmpTraitSelector |
| 156 | +!PARSE-TREE: | | | OmpTraitSelectorName -> Value = Condition |
| 157 | +!PARSE-TREE: | | | Properties |
| 158 | +!PARSE-TREE: | | | | OmpTraitProperty -> Scalar -> Expr = '.true._4' |
| 159 | +!PARSE-TREE: | | | | | LiteralConstant -> LogicalLiteralConstant |
| 160 | +!PARSE-TREE: | | | | | | bool = 'true' |
| 161 | + |
| 162 | +subroutine f06 |
| 163 | + implicit none |
| 164 | + integer :: i |
| 165 | + !$omp target_data map(tofrom: i) |
| 166 | + i = 0 |
| 167 | + !$omp end target data |
| 168 | +end |
| 169 | + |
| 170 | +!UNPARSE: SUBROUTINE f06 |
| 171 | +!UNPARSE: IMPLICIT NONE |
| 172 | +!UNPARSE: INTEGER i |
| 173 | +!UNPARSE: !$OMP TARGET DATA MAP(TOFROM: i) |
| 174 | +!UNPARSE: i=0_4 |
| 175 | +!UNPARSE: !$OMP END TARGET DATA |
| 176 | +!UNPARSE: END SUBROUTINE |
| 177 | + |
| 178 | +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPBlockConstruct |
| 179 | +!PARSE-TREE: | OmpBeginBlockDirective |
| 180 | +!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target data |
| 181 | +!PARSE-TREE: | | OmpClauseList -> OmpClause -> Map -> OmpMapClause |
| 182 | +!PARSE-TREE: | | | Modifier -> OmpMapType -> Value = Tofrom |
| 183 | +!PARSE-TREE: | | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i' |
| 184 | +!PARSE-TREE: | | | bool = 'true' |
| 185 | +!PARSE-TREE: | Block |
| 186 | +!PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt = 'i=0_4' |
| 187 | +!PARSE-TREE: | | | Variable = 'i' |
| 188 | +!PARSE-TREE: | | | | Designator -> DataRef -> Name = 'i' |
| 189 | +!PARSE-TREE: | | | Expr = '0_4' |
| 190 | +!PARSE-TREE: | | | | LiteralConstant -> IntLiteralConstant = '0' |
| 191 | +!PARSE-TREE: | OmpEndBlockDirective |
| 192 | +!PARSE-TREE: | | OmpBlockDirective -> llvm::omp::Directive = target data |
| 193 | +!PARSE-TREE: | | OmpClauseList -> |
| 194 | + |
| 195 | +subroutine f07 |
| 196 | + implicit none |
| 197 | + integer :: i |
| 198 | + !$omp target_enter_data map(to: i) |
| 199 | +end |
| 200 | + |
| 201 | +!UNPARSE: SUBROUTINE f07 |
| 202 | +!UNPARSE: IMPLICIT NONE |
| 203 | +!UNPARSE: INTEGER i |
| 204 | +!UNPARSE: !$OMP TARGET_ENTER_DATA MAP(TO: i) |
| 205 | +!UNPARSE: END SUBROUTINE |
| 206 | + |
| 207 | +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification |
| 208 | +!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target enter data |
| 209 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause |
| 210 | +!PARSE-TREE: | | Modifier -> OmpMapType -> Value = To |
| 211 | +!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i' |
| 212 | +!PARSE-TREE: | | bool = 'true' |
| 213 | +!PARSE-TREE: | Flags = None |
| 214 | + |
| 215 | +subroutine f08 |
| 216 | + implicit none |
| 217 | + integer :: i |
| 218 | + !$omp target_exit_data map(from: i) |
| 219 | +end |
| 220 | + |
| 221 | +!UNPARSE: SUBROUTINE f08 |
| 222 | +!UNPARSE: IMPLICIT NONE |
| 223 | +!UNPARSE: INTEGER i |
| 224 | +!UNPARSE: !$OMP TARGET_EXIT_DATA MAP(FROM: i) |
| 225 | +!UNPARSE: END SUBROUTINE |
| 226 | + |
| 227 | +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification |
| 228 | +!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target exit data |
| 229 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> Map -> OmpMapClause |
| 230 | +!PARSE-TREE: | | Modifier -> OmpMapType -> Value = From |
| 231 | +!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i' |
| 232 | +!PARSE-TREE: | | bool = 'true' |
| 233 | +!PARSE-TREE: | Flags = None |
| 234 | + |
| 235 | +subroutine f09 |
| 236 | + implicit none |
| 237 | + integer :: i |
| 238 | + !$omp target_update to(i) |
| 239 | +end |
| 240 | + |
| 241 | +!UNPARSE: SUBROUTINE f09 |
| 242 | +!UNPARSE: IMPLICIT NONE |
| 243 | +!UNPARSE: INTEGER i |
| 244 | +!UNPARSE: !$OMP TARGET_UPDATE TO(i) |
| 245 | +!UNPARSE: END SUBROUTINE |
| 246 | + |
| 247 | +!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct -> OmpDirectiveSpecification |
| 248 | +!PARSE-TREE: | OmpDirectiveName -> llvm::omp::Directive = target update |
| 249 | +!PARSE-TREE: | OmpClauseList -> OmpClause -> To -> OmpToClause |
| 250 | +!PARSE-TREE: | | OmpObjectList -> OmpObject -> Designator -> DataRef -> Name = 'i' |
| 251 | +!PARSE-TREE: | | bool = 'true' |
| 252 | +!PARSE-TREE: | Flags = None |
0 commit comments