1 ! RUN: %flang_fc1 -fdebug-unparse-no-sema -fopenmp %s | FileCheck --ignore-case %s
2 ! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp %s | FileCheck --check-prefix="PARSE-TREE" %s
3 ! Checks the parsing of Openmp 5.0 Target Device constructs
12 !------------------------------------------------------
13 ! Check Device clause with a constant argument
14 !------------------------------------------------------
15 !CHECK: !$OMP TARGET DEVICE(1)
16 !$OMP TARGET DEVICE(1)
18 !CHECK: !$OMP END TARGET
21 !PARSE-TREE: OmpBeginBlockDirective
22 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
23 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
24 !PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
25 !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
26 !PARSE-TREE: OmpEndBlockDirective
27 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
28 !PARSE-TREE: OmpClauseList ->
30 !------------------------------------------------------
31 ! Check Device clause with a constant integer expression argument
32 !------------------------------------------------------
33 !CHECK: !$OMP TARGET DEVICE(2-1)
34 !$OMP TARGET DEVICE(2-1)
36 !CHECK: !$OMP END TARGET
39 !PARSE-TREE: OmpBeginBlockDirective
40 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
41 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
42 !PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
44 !PARSE-TREE: Expr = '2_4'
45 !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
46 !PARSE-TREE: Expr = '1_4'
47 !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
48 !PARSE-TREE: OmpEndBlockDirective
49 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
50 !PARSE-TREE: OmpClauseList ->
53 !------------------------------------------------------
54 ! Check Device clause with a variable argument
55 !------------------------------------------------------
56 !CHECK: !$OMP TARGET DEVICE(X)
57 !$OMP TARGET DEVICE(X)
59 !CHECK: !$OMP END TARGET
62 !PARSE-TREE: OmpBeginBlockDirective
63 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
64 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
65 !PARSE-TREE: Scalar -> Integer -> Expr = 'x'
66 !PARSE-TREE: Designator -> DataRef -> Name = 'x'
67 !PARSE-TREE: OmpEndBlockDirective
68 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
69 !PARSE-TREE: OmpClauseList ->
72 !------------------------------------------------------
73 ! Check Device clause with an variable integer expression
74 !------------------------------------------------------
75 !CHECK: !$OMP TARGET DEVICE(X+Y)
76 !$OMP TARGET DEVICE(X+Y)
78 !CHECK: !$OMP END TARGET
81 !PARSE-TREE: OmpBeginBlockDirective
82 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
83 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
84 !PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
86 !PARSE-TREE: Expr = 'x'
87 !PARSE-TREE: Designator -> DataRef -> Name = 'x'
88 !PARSE-TREE: Expr = 'y'
89 !PARSE-TREE: Designator -> DataRef -> Name = 'y'
90 !PARSE-TREE: OmpEndBlockDirective
91 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
92 !PARSE-TREE: OmpClauseList ->
94 !------------------------------------------------------
95 ! Check Device Ancestor clause with a constant argument
96 !------------------------------------------------------
97 !CHECK: !$OMP TARGET DEVICE(ANCESTOR:1)
98 !$OMP TARGET DEVICE(ANCESTOR: 1)
100 !CHECK: !$OMP END TARGET
103 !PARSE-TREE: OmpBeginBlockDirective
104 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
105 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
106 !PARSE-TREE: DeviceModifier = Ancestor
107 !PARSE-TREE: Scalar -> Integer -> Expr = '1_4'
108 !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '1'
109 !PARSE-TREE: OmpEndBlockDirective
110 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
111 !PARSE-TREE: OmpClauseList ->
114 !--------------------------------------------------------
115 ! Check Device Devive-Num clause with a constant argument
116 !--------------------------------------------------------
117 !CHECK: !$OMP TARGET DEVICE(DEVICE_NUM:2)
118 !$OMP TARGET DEVICE(DEVICE_NUM: 2)
120 !CHECK: !$OMP END TARGET
123 !PARSE-TREE: OmpBeginBlockDirective
124 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
125 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
126 !PARSE-TREE: DeviceModifier = Device_Num
127 !PARSE-TREE: Scalar -> Integer -> Expr = '2_4'
128 !PARSE-TREE: LiteralConstant -> IntLiteralConstant = '2'
129 !PARSE-TREE: OmpEndBlockDirective
130 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
131 !PARSE-TREE: OmpClauseList ->
134 !-------------------------------------------------------------------
135 ! Check Device Ancestor clause with a variable expression argument
136 !-------------------------------------------------------------------
137 !CHECK: !$OMP TARGET DEVICE(ANCESTOR:X+Y)
138 !$OMP TARGET DEVICE(ANCESTOR: X + Y)
140 !CHECK: !$OMP END TARGET
143 !PARSE-TREE: OmpBeginBlockDirective
144 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
145 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
146 !PARSE-TREE: DeviceModifier = Ancestor
147 !PARSE-TREE: Scalar -> Integer -> Expr = 'x+y'
149 !PARSE-TREE: Expr = 'x'
150 !PARSE-TREE: Designator -> DataRef -> Name = 'x'
151 !PARSE-TREE: Expr = 'y'
152 !PARSE-TREE: Designator -> DataRef -> Name = 'y'
153 !PARSE-TREE: OmpEndBlockDirective
154 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
155 !PARSE-TREE: OmpClauseList ->
158 !-------------------------------------------------------------------
159 ! Check Device Devive-Num clause with a variable expression argument
160 !-------------------------------------------------------------------
161 !CHECK: !$OMP TARGET DEVICE(DEVICE_NUM:X-Y)
162 !$OMP TARGET DEVICE(DEVICE_NUM: X - Y)
164 !CHECK: !$OMP END TARGET
167 !PARSE-TREE: OmpBeginBlockDirective
168 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target
169 !PARSE-TREE: OmpClauseList -> OmpClause -> Device -> OmpDeviceClause
170 !PARSE-TREE: DeviceModifier = Device_Num
171 !PARSE-TREE: Scalar -> Integer -> Expr = 'x-y'
172 !PARSE-TREE: Subtract
173 !PARSE-TREE: Expr = 'x'
174 !PARSE-TREE: Designator -> DataRef -> Name = 'x'
175 !PARSE-TREE: Expr = 'y'
176 !PARSE-TREE: Designator -> DataRef -> Name = 'y'
177 !PARSE-TREE: OmpEndBlockDirective
178 !PARSE-TREE: OmpBlockDirective -> llvm::omp::Directive = target