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