xref: /illumos-gate/usr/src/tools/smatch/src/validation/optim/cast-kinds.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)
1 typedef unsigned int uint;
2 typedef unsigned long ulong;
3 
uint_2_int(uint a)4 static int uint_2_int(uint a) { return (int)a; }
long_2_int(long a)5 static int long_2_int(long a) { return (int)a; }
ulong_2_int(ulong a)6 static int ulong_2_int(ulong a) { return (int)a; }
vptr_2_int(void * a)7 static int vptr_2_int(void *a) { return (int)a; }
iptr_2_int(int * a)8 static int iptr_2_int(int *a) { return (int)a; }
float_2_int(float a)9 static int float_2_int(float a) { return (int)a; }
double_2_int(double a)10 static int double_2_int(double a) { return (int)a; }
int_2_uint(int a)11 static uint int_2_uint(int a) { return (uint)a; }
long_2_uint(long a)12 static uint long_2_uint(long a) { return (uint)a; }
ulong_2_uint(ulong a)13 static uint ulong_2_uint(ulong a) { return (uint)a; }
vptr_2_uint(void * a)14 static uint vptr_2_uint(void *a) { return (uint)a; }
iptr_2_uint(int * a)15 static uint iptr_2_uint(int *a) { return (uint)a; }
float_2_uint(float a)16 static uint float_2_uint(float a) { return (uint)a; }
double_2_uint(double a)17 static uint double_2_uint(double a) { return (uint)a; }
int_2_long(int a)18 static long int_2_long(int a) { return (long)a; }
uint_2_long(uint a)19 static long uint_2_long(uint a) { return (long)a; }
ulong_2_long(ulong a)20 static long ulong_2_long(ulong a) { return (long)a; }
vptr_2_long(void * a)21 static long vptr_2_long(void *a) { return (long)a; }
iptr_2_long(int * a)22 static long iptr_2_long(int *a) { return (long)a; }
float_2_long(float a)23 static long float_2_long(float a) { return (long)a; }
double_2_long(double a)24 static long double_2_long(double a) { return (long)a; }
int_2_ulong(int a)25 static ulong int_2_ulong(int a) { return (ulong)a; }
uint_2_ulong(uint a)26 static ulong uint_2_ulong(uint a) { return (ulong)a; }
long_2_ulong(long a)27 static ulong long_2_ulong(long a) { return (ulong)a; }
vptr_2_ulong(void * a)28 static ulong vptr_2_ulong(void *a) { return (ulong)a; }
iptr_2_ulong(int * a)29 static ulong iptr_2_ulong(int *a) { return (ulong)a; }
float_2_ulong(float a)30 static ulong float_2_ulong(float a) { return (ulong)a; }
double_2_ulong(double a)31 static ulong double_2_ulong(double a) { return (ulong)a; }
int_2_vptr(int a)32 static void * int_2_vptr(int a) { return (void *)a; }
uint_2_vptr(uint a)33 static void * uint_2_vptr(uint a) { return (void *)a; }
long_2_vptr(long a)34 static void * long_2_vptr(long a) { return (void *)a; }
ulong_2_vptr(ulong a)35 static void * ulong_2_vptr(ulong a) { return (void *)a; }
iptr_2_vptr(int * a)36 static void * iptr_2_vptr(int *a) { return (void *)a; }
int_2_iptr(int a)37 static int * int_2_iptr(int a) { return (int *)a; }
uint_2_iptr(uint a)38 static int * uint_2_iptr(uint a) { return (int *)a; }
long_2_iptr(long a)39 static int * long_2_iptr(long a) { return (int *)a; }
ulong_2_iptr(ulong a)40 static int * ulong_2_iptr(ulong a) { return (int *)a; }
vptr_2_iptr(void * a)41 static int * vptr_2_iptr(void *a) { return (int *)a; }
int_2_float(int a)42 static float int_2_float(int a) { return (float)a; }
uint_2_float(uint a)43 static float uint_2_float(uint a) { return (float)a; }
long_2_float(long a)44 static float long_2_float(long a) { return (float)a; }
ulong_2_float(ulong a)45 static float ulong_2_float(ulong a) { return (float)a; }
double_2_float(double a)46 static float double_2_float(double a) { return (float)a; }
int_2_double(int a)47 static double int_2_double(int a) { return (double)a; }
uint_2_double(uint a)48 static double uint_2_double(uint a) { return (double)a; }
long_2_double(long a)49 static double long_2_double(long a) { return (double)a; }
ulong_2_double(ulong a)50 static double ulong_2_double(ulong a) { return (double)a; }
float_2_double(float a)51 static double float_2_double(float a) { return (double)a; }
52 
float_2_float(float a)53 static float float_2_float(float a) { return a; }
double_2_double(double a)54 static double double_2_double(double a) { return a; }
55 
56 /*
57  * check-name: cast-kinds
58  * check-command: test-linearize -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -m64 $file
59  * check-assert: sizeof(void *) == 8 && sizeof(long) == 8 && sizeof(double) == 8
60  *
61  * check-output-start
62 uint_2_int:
63 .L0:
64 	<entry-point>
65 	ret.32      %arg1
66 
67 
68 long_2_int:
69 .L2:
70 	<entry-point>
71 	trunc.32    %r4 <- (64) %arg1
72 	ret.32      %r4
73 
74 
75 ulong_2_int:
76 .L4:
77 	<entry-point>
78 	trunc.32    %r7 <- (64) %arg1
79 	ret.32      %r7
80 
81 
82 vptr_2_int:
83 .L6:
84 	<entry-point>
85 	trunc.32    %r10 <- (64) %arg1
86 	ret.32      %r10
87 
88 
89 iptr_2_int:
90 .L8:
91 	<entry-point>
92 	trunc.32    %r14 <- (64) %arg1
93 	ret.32      %r14
94 
95 
96 float_2_int:
97 .L10:
98 	<entry-point>
99 	fcvts.32    %r17 <- (32) %arg1
100 	ret.32      %r17
101 
102 
103 double_2_int:
104 .L12:
105 	<entry-point>
106 	fcvts.32    %r20 <- (64) %arg1
107 	ret.32      %r20
108 
109 
110 int_2_uint:
111 .L14:
112 	<entry-point>
113 	ret.32      %arg1
114 
115 
116 long_2_uint:
117 .L16:
118 	<entry-point>
119 	trunc.32    %r25 <- (64) %arg1
120 	ret.32      %r25
121 
122 
123 ulong_2_uint:
124 .L18:
125 	<entry-point>
126 	trunc.32    %r28 <- (64) %arg1
127 	ret.32      %r28
128 
129 
130 vptr_2_uint:
131 .L20:
132 	<entry-point>
133 	trunc.32    %r31 <- (64) %arg1
134 	ret.32      %r31
135 
136 
137 iptr_2_uint:
138 .L22:
139 	<entry-point>
140 	trunc.32    %r35 <- (64) %arg1
141 	ret.32      %r35
142 
143 
144 float_2_uint:
145 .L24:
146 	<entry-point>
147 	fcvtu.32    %r38 <- (32) %arg1
148 	ret.32      %r38
149 
150 
151 double_2_uint:
152 .L26:
153 	<entry-point>
154 	fcvtu.32    %r41 <- (64) %arg1
155 	ret.32      %r41
156 
157 
158 int_2_long:
159 .L28:
160 	<entry-point>
161 	sext.64     %r44 <- (32) %arg1
162 	ret.64      %r44
163 
164 
165 uint_2_long:
166 .L30:
167 	<entry-point>
168 	zext.64     %r47 <- (32) %arg1
169 	ret.64      %r47
170 
171 
172 ulong_2_long:
173 .L32:
174 	<entry-point>
175 	ret.64      %arg1
176 
177 
178 vptr_2_long:
179 .L34:
180 	<entry-point>
181 	ret.64      %arg1
182 
183 
184 iptr_2_long:
185 .L36:
186 	<entry-point>
187 	ret.64      %arg1
188 
189 
190 float_2_long:
191 .L38:
192 	<entry-point>
193 	fcvts.64    %r57 <- (32) %arg1
194 	ret.64      %r57
195 
196 
197 double_2_long:
198 .L40:
199 	<entry-point>
200 	fcvts.64    %r60 <- (64) %arg1
201 	ret.64      %r60
202 
203 
204 int_2_ulong:
205 .L42:
206 	<entry-point>
207 	sext.64     %r63 <- (32) %arg1
208 	ret.64      %r63
209 
210 
211 uint_2_ulong:
212 .L44:
213 	<entry-point>
214 	zext.64     %r66 <- (32) %arg1
215 	ret.64      %r66
216 
217 
218 long_2_ulong:
219 .L46:
220 	<entry-point>
221 	ret.64      %arg1
222 
223 
224 vptr_2_ulong:
225 .L48:
226 	<entry-point>
227 	ret.64      %arg1
228 
229 
230 iptr_2_ulong:
231 .L50:
232 	<entry-point>
233 	ret.64      %arg1
234 
235 
236 float_2_ulong:
237 .L52:
238 	<entry-point>
239 	fcvtu.64    %r76 <- (32) %arg1
240 	ret.64      %r76
241 
242 
243 double_2_ulong:
244 .L54:
245 	<entry-point>
246 	fcvtu.64    %r79 <- (64) %arg1
247 	ret.64      %r79
248 
249 
250 int_2_vptr:
251 .L56:
252 	<entry-point>
253 	sext.64     %r82 <- (32) %arg1
254 	ret.64      %r82
255 
256 
257 uint_2_vptr:
258 .L58:
259 	<entry-point>
260 	zext.64     %r85 <- (32) %arg1
261 	ret.64      %r85
262 
263 
264 long_2_vptr:
265 .L60:
266 	<entry-point>
267 	ret.64      %arg1
268 
269 
270 ulong_2_vptr:
271 .L62:
272 	<entry-point>
273 	ret.64      %arg1
274 
275 
276 iptr_2_vptr:
277 .L64:
278 	<entry-point>
279 	ret.64      %arg1
280 
281 
282 int_2_iptr:
283 .L66:
284 	<entry-point>
285 	sext.64     %r94 <- (32) %arg1
286 	ret.64      %r94
287 
288 
289 uint_2_iptr:
290 .L68:
291 	<entry-point>
292 	zext.64     %r98 <- (32) %arg1
293 	ret.64      %r98
294 
295 
296 long_2_iptr:
297 .L70:
298 	<entry-point>
299 	ret.64      %arg1
300 
301 
302 ulong_2_iptr:
303 .L72:
304 	<entry-point>
305 	ret.64      %arg1
306 
307 
308 vptr_2_iptr:
309 .L74:
310 	<entry-point>
311 	ptrcast.64  %r108 <- (64) %arg1
312 	ret.64      %r108
313 
314 
315 int_2_float:
316 .L76:
317 	<entry-point>
318 	scvtf.32    %r111 <- (32) %arg1
319 	ret.32      %r111
320 
321 
322 uint_2_float:
323 .L78:
324 	<entry-point>
325 	ucvtf.32    %r114 <- (32) %arg1
326 	ret.32      %r114
327 
328 
329 long_2_float:
330 .L80:
331 	<entry-point>
332 	scvtf.32    %r117 <- (64) %arg1
333 	ret.32      %r117
334 
335 
336 ulong_2_float:
337 .L82:
338 	<entry-point>
339 	ucvtf.32    %r120 <- (64) %arg1
340 	ret.32      %r120
341 
342 
343 double_2_float:
344 .L84:
345 	<entry-point>
346 	fcvtf.32    %r123 <- (64) %arg1
347 	ret.32      %r123
348 
349 
350 int_2_double:
351 .L86:
352 	<entry-point>
353 	scvtf.64    %r126 <- (32) %arg1
354 	ret.64      %r126
355 
356 
357 uint_2_double:
358 .L88:
359 	<entry-point>
360 	ucvtf.64    %r129 <- (32) %arg1
361 	ret.64      %r129
362 
363 
364 long_2_double:
365 .L90:
366 	<entry-point>
367 	scvtf.64    %r132 <- (64) %arg1
368 	ret.64      %r132
369 
370 
371 ulong_2_double:
372 .L92:
373 	<entry-point>
374 	ucvtf.64    %r135 <- (64) %arg1
375 	ret.64      %r135
376 
377 
378 float_2_double:
379 .L94:
380 	<entry-point>
381 	fcvtf.64    %r138 <- (32) %arg1
382 	ret.64      %r138
383 
384 
385 float_2_float:
386 .L96:
387 	<entry-point>
388 	ret.32      %arg1
389 
390 
391 double_2_double:
392 .L98:
393 	<entry-point>
394 	ret.64      %arg1
395 
396 
397  * check-output-end
398  */
399