[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / AST / float16.cpp
blob9e0d70b9a1c006eb25e82ede6d54e5ad98ebfa4b
1 // Tests without serialization:
2 // RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu %s \
3 // RUN: | FileCheck %s --strict-whitespace
4 //
5 // RUN: %clang_cc1 -std=c++11 -ast-dump -triple aarch64-linux-gnu -fnative-half-type %s \
6 // RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
7 //
8 // Tests with serialization:
9 // RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -emit-pch -o %t %s
10 // RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -include-pch %t -ast-dump-all /dev/null \
11 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
12 // RUN: | FileCheck %s --strict-whitespace
14 // RUN: %clang_cc1 -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -emit-pch -o %t %s
15 // RUN: %clang_cc1 -x c++ -std=c++11 -triple aarch64-linux-gnu -fnative-half-type -include-pch %t -ast-dump-all /dev/null \
16 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
17 // RUN: | FileCheck %s --check-prefix=CHECK-NATIVE --strict-whitespace
19 /* Various contexts where type _Float16 can appear. */
21 /* Namespace */
22 namespace {
23 _Float16 f1n;
24 _Float16 f2n = 33.f16;
25 _Float16 arr1n[10];
26 _Float16 arr2n[] = { 1.2, 3.0, 3.e4 };
27 const volatile _Float16 func1n(const _Float16 &arg) {
28 return arg + f2n + arr1n[4] - arr2n[1];
32 //CHECK: |-NamespaceDecl
33 //CHECK-NEXT: | |-VarDecl {{.*}} f1n '_Float16'
34 //CHECK-NEXT: | |-VarDecl {{.*}} f2n '_Float16' cinit
35 //CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 3.300000e+01
36 //CHECK-NEXT: | |-VarDecl {{.*}} arr1n '_Float16[10]'
37 //CHECK-NEXT: | |-VarDecl {{.*}} arr2n '_Float16[3]' cinit
38 //CHECK-NEXT: | | `-InitListExpr {{.*}} '_Float16[3]'
39 //CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
40 //CHECK-NEXT: | | | `-FloatingLiteral {{.*}} 'double' 1.200000e+00
41 //CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
42 //CHECK-NEXT: | | | `-FloatingLiteral {{.*}} 'double' 3.000000e+00
43 //CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
44 //CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 3.000000e+04
45 //CHECK-NEXT: | `-FunctionDecl {{.*}} func1n 'const volatile _Float16 (const _Float16 &)'
47 /* File */
48 _Float16 f1f;
49 _Float16 f2f = 32.4;
50 _Float16 arr1f[10];
51 _Float16 arr2f[] = { -1.2, -3.0, -3.e4 };
52 _Float16 func1f(_Float16 arg);
54 //CHECK: |-VarDecl {{.*}} f1f '_Float16'
55 //CHECK-NEXT: |-VarDecl {{.*}} f2f '_Float16' cinit
56 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
57 //CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 3.240000e+01
58 //CHECK-NEXT: |-VarDecl {{.*}} arr1f '_Float16[10]'
59 //CHECK-NEXT: |-VarDecl {{.*}} arr2f '_Float16[3]' cinit
60 //CHECK-NEXT: | `-InitListExpr {{.*}} '_Float16[3]'
61 //CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
62 //CHECK-NEXT: | | `-UnaryOperator {{.*}} 'double' prefix '-'
63 //CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 1.200000e+00
64 //CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
65 //CHECK-NEXT: | | `-UnaryOperator {{.*}} 'double' prefix '-'
66 //CHECK-NEXT: | | `-FloatingLiteral {{.*}} 'double' 3.000000e+00
67 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
68 //CHECK-NEXT: | `-UnaryOperator {{.*}} 'double' prefix '-'
69 //CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 3.000000e+04
70 //CHECK-NEXT: |-FunctionDecl {{.*}} func1f '_Float16 (_Float16)'
71 //CHECK-NEXT: | `-ParmVarDecl {{.*}} arg '_Float16'
74 // Mixing __fp16 and Float16 types:
75 // The _Float16 type is first converted to __fp16 type and then the operation
76 // is completed as if both operands were of __fp16 type.
78 __fp16 B = -0.1;
79 auto C = -1.0f16 + B;
81 // When we do *not* have native half types, we expect __fp16 to be promoted to
82 // float, and consequently also _Float16 promotions to float:
84 //CHECK: -VarDecl {{.*}} used B '__fp16' cinit
85 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
86 //CHECK-NEXT: | `-UnaryOperator {{.*}} 'double' prefix '-'
87 //CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 1.000000e-01
88 //CHECK-NEXT: |-VarDecl {{.*}} C 'float':'float' cinit
89 //CHECK-NEXT: | `-BinaryOperator {{.*}} 'float' '+'
90 //CHECK-NEXT: | |-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
91 //CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
92 //CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
93 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
94 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fp16' <LValueToRValue>
95 //CHECK-NEXT: | `-DeclRefExpr {{.*}} '__fp16' lvalue Var 0x{{.*}} 'B' '__fp16'
97 // When do have native half types, we expect to see promotions to fp16:
99 //CHECK-NATIVE: |-VarDecl {{.*}} used B '__fp16' cinit
100 //CHECK-NATIVE: | `-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
101 //CHECK-NATIVE: | `-UnaryOperator {{.*}} 'double' prefix '-'
102 //CHECK-NATIVE: | `-FloatingLiteral {{.*}} 'double' 1.000000e-01
103 //CHECK-NATIVE: |-VarDecl {{.*}} C '__fp16':'__fp16' cinit
104 //CHECK-NATIVE: | `-BinaryOperator {{.*}} '__fp16' '+'
105 //CHECK-NATIVE: | |-ImplicitCastExpr {{.*}} '__fp16' <FloatingCast>
106 //CHECK-NATIVE: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
107 //CHECK-NATIVE: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
108 //CHECK-NATIVE: | `-ImplicitCastExpr {{.*}} '__fp16' <LValueToRValue>
109 //CHECK-NATIVE: | `-DeclRefExpr {{.*}} '__fp16' lvalue Var 0x{{.*}} 'B' '__fp16'
112 /* Class */
114 class C1 {
115 _Float16 f1c;
116 static const _Float16 f2c;
117 volatile _Float16 f3c;
118 public:
119 C1(_Float16 arg) : f1c(arg), f3c(arg) { }
120 _Float16 func1c(_Float16 arg ) {
121 return f1c + arg;
123 static _Float16 func2c(_Float16 arg) {
124 return arg * C1::f2c;
128 //CHECK: |-CXXRecordDecl {{.*}} referenced class C1 definition
129 //CHECK: | |-CXXRecordDecl {{.*}} implicit referenced class C1
130 //CHECK-NEXT: | |-FieldDecl {{.*}} referenced f1c '_Float16'
131 //CHECK-NEXT: | |-VarDecl {{.*}} used f2c 'const _Float16' static
132 //CHECK-NEXT: | |-FieldDecl {{.*}} f3c 'volatile _Float16'
133 //CHECK-NEXT: | |-AccessSpecDecl
134 //CHECK-NEXT: | |-CXXConstructorDecl {{.*}} used C1 'void (_Float16)
135 //CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
136 //CHECK-NEXT: | | |-CXXCtorInitializer Field {{.*}} 'f1c' '_Float16'
137 //CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
138 //CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
139 //CHECK-NEXT: | | |-CXXCtorInitializer Field {{.*}} 'f3c' 'volatile _Float16'
140 //CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
141 //CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
142 //CHECK-NEXT: | | `-CompoundStmt
143 //CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func1c '_Float16 (_Float16)
144 //CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
145 //CHECK-NEXT: | | `-CompoundStmt
146 //CHECK-NEXT: | | `-ReturnStmt
147 //CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '+'
148 //CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
149 //CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue ->f1c 0x{{.*}}
150 //CHECK-NEXT: | | | `-CXXThisExpr {{.*}} 'C1 *' implicit this
151 //CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
152 //CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
153 //CHECK-NEXT: | |-CXXMethodDecl {{.*}} used func2c '_Float16 (_Float16)' static
154 //CHECK-NEXT: | | |-ParmVarDecl {{.*}} used arg '_Float16'
155 //CHECK-NEXT: | | `-CompoundStmt
156 //CHECK-NEXT: | | `-ReturnStmt
157 //CHECK-NEXT: | | `-BinaryOperator {{.*}} '_Float16' '*'
158 //CHECK-NEXT: | | |-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
159 //CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '_Float16' lvalue ParmVar 0x{{.*}} 'arg' '_Float16'
160 //CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
161 //CHECK-NEXT: | | `-DeclRefExpr {{.*}} 'const _Float16' lvalue Var 0x{{.*}} 'f2c' 'const _Float16'
164 /* Template */
166 template <class C> C func1t(C arg) {
167 return arg * 2.f16;
170 //CHECK: |-FunctionTemplateDecl {{.*}} func1t
171 //CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} C
172 //CHECK-NEXT: | |-FunctionDecl {{.*}} func1t 'C (C)'
173 //CHECK-NEXT: | | |-ParmVarDecl {{.*}} referenced arg 'C'
174 //CHECK-NEXT: | | `-CompoundStmt
175 //CHECK-NEXT: | | `-ReturnStmt
176 //CHECK-NEXT: | | `-BinaryOperator {{.*}} '<dependent type>' '*'
177 //CHECK-NEXT: | | |-DeclRefExpr {{.*}} 'C' lvalue ParmVar {{.*}} 'arg' 'C'
178 //CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 2.000000e+00
179 //CHECK-NEXT: | `-FunctionDecl {{.*}} used func1t '_Float16 (_Float16)'
180 //CHECK-NEXT: | |-TemplateArgument type '_Float16'
181 //CHECK: | |-ParmVarDecl {{.*}} used arg '_Float16':'_Float16'
182 //CHECK-NEXT: | `-CompoundStmt
183 //CHECK-NEXT: | `-ReturnStmt
184 //CHECK-NEXT: | `-BinaryOperator {{.*}} '_Float16' '*'
185 //CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16':'_Float16' <LValueToRValue>
186 //CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16':'_Float16' lvalue ParmVar {{.*}} 'arg' '_Float16':'_Float16'
187 //CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 2.000000e+00
190 template <class C> struct S1 {
191 C mem1;
194 //CHECK: |-ClassTemplateDecl {{.*}} S1
195 //CHECK-NEXT: | |-TemplateTypeParmDecl {{.*}} referenced class depth 0 index 0 C
196 //CHECK-NEXT: | |-CXXRecordDecl {{.*}} struct S1 definition
197 //CHECK: | | |-CXXRecordDecl {{.*}} implicit struct S1
198 //CHECK-NEXT: | | `-FieldDecl {{.*}} mem1 'C'
199 //CHECK-NEXT: | `-ClassTemplateSpecialization {{.*}} 'S1'
201 template <> struct S1<_Float16> {
202 _Float16 mem2;
206 /* Local */
208 extern int printf (const char *__restrict __format, ...);
210 int main(void) {
211 _Float16 f1l = 1e3f16;
212 //CHECK: | `-VarDecl {{.*}} used f1l '_Float16' cinit
213 //CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+03
215 _Float16 f2l = -0.f16;
216 //CHECK: | `-VarDecl {{.*}} used f2l '_Float16' cinit
217 //CHECK-NEXT: | `-UnaryOperator {{.*}} '_Float16' prefix '-'
218 //CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 0.000000e+00
220 _Float16 f3l = 1.000976562;
221 //CHECK: | `-VarDecl {{.*}} used f3l '_Float16' cinit
222 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
223 //CHECK-NEXT: | `-FloatingLiteral {{.*}} 'double' 1.000977e+00
225 C1 c1(f1l);
226 //CHECK: | `-VarDecl{{.*}} used c1 'C1':'C1' callinit
227 //CHECK-NEXT: | `-CXXConstructExpr {{.*}} 'C1':'C1' 'void (_Float16)
228 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
229 //CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var 0x{{.*}} 'f1l' '_Float16'
231 S1<_Float16> s1 = { 132.f16 };
232 //CHECK: | `-VarDecl {{.*}} used s1 'S1<_Float16>':'S1<_Float16>' cinit
233 //CHECK-NEXT: | `-InitListExpr {{.*}} 'S1<_Float16>':'S1<_Float16>'
234 //CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.320000e+02
236 _Float16 f4l = func1n(f1l) + func1f(f2l) + c1.func1c(f3l) + c1.func2c(f1l) +
237 func1t(f1l) + s1.mem2 - f1n + f2n;
238 //CHECK: | `-VarDecl {{.*}} used f4l '_Float16' cinit
239 //CHECK-NEXT: | `-BinaryOperator {{.*}} '_Float16' '+'
240 //CHECK-NEXT: | |-BinaryOperator {{.*}} '_Float16' '-'
241 //CHECK-NEXT: | | |-BinaryOperator {{.*}} '_Float16' '+'
242 //CHECK-NEXT: | | | |-BinaryOperator {{.*}} '_Float16' '+'
243 //CHECK-NEXT: | | | | |-BinaryOperator {{.*}} '_Float16' '+'
244 //CHECK-NEXT: | | | | | |-BinaryOperator {{.*}} '_Float16' '+'
245 //CHECK-NEXT: | | | | | | |-BinaryOperator {{.*}} '_Float16' '+'
246 //CHECK-NEXT: | | | | | | | |-CallExpr {{.*}} '_Float16'
247 //CHECK-NEXT: | | | | | | | | |-ImplicitCastExpr {{.*}} 'const volatile _Float16 (*)(const _Float16 &)' <FunctionToPointerDecay>
248 //CHECK-NEXT: | | | | | | | | | `-DeclRefExpr {{.*}} 'const volatile _Float16 (const _Float16 &)' lvalue Function {{.*}} 'func1n' 'const volatile _Float16 (const _Float16 &)'
249 //CHECK-NEXT: | | | | | | | | `-ImplicitCastExpr {{.*}} 'const _Float16' lvalue <NoOp>
250 //CHECK-NEXT: | | | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
251 //CHECK-NEXT: | | | | | | | `-CallExpr {{.*}} '_Float16'
252 //CHECK-NEXT: | | | | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
253 //CHECK-NEXT: | | | | | | | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1f' '_Float16 (_Float16)'
254 //CHECK-NEXT: | | | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
255 //CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2l' '_Float16'
256 //CHECK-NEXT: | | | | | | `-CXXMemberCallExpr {{.*}} '_Float16'
257 //CHECK-NEXT: | | | | | | |-MemberExpr {{.*}} '<bound member function type>' .func1c {{.*}}
258 //CHECK-NEXT: | | | | | | | `-DeclRefExpr {{.*}} 'C1':'C1' lvalue Var {{.*}} 'c1' 'C1':'C1'
259 //CHECK-NEXT: | | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
260 //CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f3l' '_Float16'
261 //CHECK-NEXT: | | | | | `-CallExpr {{.*}} '_Float16'
262 //CHECK-NEXT: | | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
263 //CHECK-NEXT: | | | | | | `-MemberExpr {{.*}} '_Float16 (_Float16)' lvalue .func2c {{.*}}
264 //CHECK-NEXT: | | | | | | `-DeclRefExpr {{.*}} 'C1':'C1' lvalue Var {{.*}} 'c1' 'C1':'C1'
265 //CHECK-NEXT: | | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
266 //CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
267 //CHECK-NEXT: | | | | `-CallExpr {{.*}} '_Float16':'_Float16'
268 //CHECK-NEXT: | | | | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
269 //CHECK-NEXT: | | | | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1t' '_Float16 (_Float16)' (FunctionTemplate {{.*}} 'func1t')
270 //CHECK-NEXT: | | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
271 //CHECK-NEXT: | | | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1l' '_Float16'
272 //CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
273 //CHECK-NEXT: | | | `-MemberExpr {{.*}} '_Float16' lvalue .mem2 {{.*}}
274 //CHECK-NEXT: | | | `-DeclRefExpr {{.*}} 'S1<_Float16>':'S1<_Float16>' lvalue Var {{.*}} 's1' 'S1<_Float16>':'S1<_Float16>'
275 //CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
276 //CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f1n' '_Float16'
277 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
278 //CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
280 auto f5l = -1.f16, *f6l = &f2l, f7l = func1t(f3l);
281 //CHECK: | |-VarDecl {{.*}} f5l '_Float16':'_Float16' cinit
282 //CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16' prefix '-'
283 //CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
284 //CHECK-NEXT: | |-VarDecl {{.*}} f6l '_Float16 *' cinit
285 //CHECK-NEXT: | | `-UnaryOperator {{.*}} '_Float16 *' prefix '&'
286 //CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2l' '_Float16'
287 //CHECK-NEXT: | `-VarDecl {{.*}} f7l '_Float16':'_Float16' cinit
288 //CHECK-NEXT: | `-CallExpr {{.*}} '_Float16':'_Float16'
289 //CHECK-NEXT: | |-ImplicitCastExpr {{.*}} '_Float16 (*)(_Float16)' <FunctionToPointerDecay>
290 //CHECK-NEXT: | | `-DeclRefExpr {{.*}} '_Float16 (_Float16)' lvalue Function {{.*}} 'func1t' '_Float16 (_Float16)' (FunctionTemplate {{.*}} 'func1t')
291 //CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
292 //CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f3l' '_Float16'
294 _Float16 f8l = f4l++;
295 //CHECK: | `-VarDecl {{.*}} f8l '_Float16' cinit
296 //CHECK-NEXT: | `-UnaryOperator {{.*}} '_Float16' postfix '++'
297 //CHECK-NEXT: | `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f4l' '_Float16'
299 _Float16 arr1l[] = { -1.f16, -0.f16, -11.f16 };
300 //CHECK: `-VarDecl {{.*}} arr1l '_Float16[3]' cinit
301 //CHECK-NEXT: `-InitListExpr {{.*}} '_Float16[3]'
302 //CHECK-NEXT: |-UnaryOperator {{.*}} '_Float16' prefix '-'
303 //CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 1.000000e+00
304 //CHECK-NEXT: |-UnaryOperator {{.*}} '_Float16' prefix '-'
305 //CHECK-NEXT: | `-FloatingLiteral {{.*}} '_Float16' 0.000000e+00
306 //CHECK-NEXT: `-UnaryOperator {{.*}} '_Float16' prefix '-'
307 //CHECK-NEXT: `-FloatingLiteral {{.*}} '_Float16' 1.100000e+01
309 float cvtf = f2n;
310 //CHECK: `-VarDecl {{.*}} cvtf 'float' cinit
311 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'float' <FloatingCast>
312 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
313 //CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
315 double cvtd = f2n;
316 //CHECK: `-VarDecl {{.*}} cvtd 'double' cinit
317 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'double' <FloatingCast>
318 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
319 //CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
321 long double cvtld = f2n;
322 //CHECK: `-VarDecl {{.*}} cvtld 'long double' cinit
323 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'long double' <FloatingCast>
324 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <LValueToRValue>
325 //CHECK-NEXT: `-DeclRefExpr {{.*}} '_Float16' lvalue Var {{.*}} 'f2n' '_Float16'
327 _Float16 f2h = 42.0f;
328 //CHECK: `-VarDecl {{.*}} f2h '_Float16' cinit
329 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
330 //CHECK-NEXT: `-FloatingLiteral {{.*}} 'float' 4.200000e+01
332 _Float16 d2h = 42.0;
333 //CHECK: `-VarDecl {{.*}} d2h '_Float16' cinit
334 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
335 //CHECK-NEXT: `-FloatingLiteral {{.*}} 'double' 4.200000e+01
337 _Float16 ld2h = 42.0l;
338 //CHECK: `-VarDecl {{.*}} ld2h '_Float16' cinit
339 //CHECK-NEXT: `-ImplicitCastExpr {{.*}} '_Float16' <FloatingCast>
340 //CHECK-NEXT: `-FloatingLiteral {{.*}} 'long double' 4.200000e+01