Overview
Comment: | invoke-x86_64.m: Fix passing of floats |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
af2a5c852ba7c7aef7cfa91fe8e0d898 |
User & Date: | js on 2017-09-21 21:45:21 |
Other Links: | manifest | tags |
Context
2017-09-23
| ||
11:05 | PLATFORMS.md: Update OpenBSD versions check-in: e2324e7835 user: js tags: trunk | |
2017-09-21
| ||
21:45 | invoke-x86_64.m: Fix passing of floats check-in: af2a5c852b user: js tags: trunk | |
20:25 | invoke-x86_64.m: Minor code style change check-in: 645b4a9e1d user: js tags: trunk | |
Changes
Modified src/invocation/invoke-x86_64.m from [f312bfc975] to [3e46ff1eb1].
︙ | ︙ | |||
262 263 264 265 266 267 268 | /* See https://bugs.llvm.org/show_bug.cgi?id=34646 */ pushGPR(&context, ¤tGPR, int128Tmp[0]); pushGPR(&context, ¤tGPR, int128Tmp[1]); # endif break; #endif case 'f':; | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | /* See https://bugs.llvm.org/show_bug.cgi?id=34646 */ pushGPR(&context, ¤tGPR, int128Tmp[0]); pushGPR(&context, ¤tGPR, int128Tmp[1]); # endif break; #endif case 'f':; double floatTmp = 0; [invocation getArgument: &floatTmp atIndex: i]; pushDouble(&context, ¤tSSE, floatTmp); break; case 'd':; double doubleTmp; [invocation getArgument: &doubleTmp |
︙ | ︙ |
Modified tests/OFInvocationTests.m from [22ff9322e7] to [da1c4d414a].
︙ | ︙ | |||
82 83 84 85 86 87 88 | : (double)d15 : (double)d16 { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } | > > > > > > > > > > > > > > > > > > > > > | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | : (double)d15 : (double)d16 { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } - (float)invocationTestMethod4: (double)d1 : (float)f2 : (float)f3 : (float)f4 : (float)f5 : (float)f6 : (float)f7 : (float)f8 : (float)f9 : (double)d10 : (float)f11 : (float)f12 : (float)f13 : (float)f14 : (float)f15 : (float)f16 { return (d1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + d10 + f11 + f12 + f13 + f14 + f15 + f16) / 16; } - (long double)invocationTestMethod5: (long double)d1 : (long double)d2 : (long double)d3 : (long double)d4 : (long double)d5 : (long double)d6 : (long double)d7 : (long double)d8 |
︙ | ︙ | |||
104 105 106 107 108 109 110 | : (long double)d16 { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } #ifndef __STDC_NO_COMPLEX__ | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | : (long double)d16 { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } #ifndef __STDC_NO_COMPLEX__ - (complex double)invocationTestMethod6: (complex float)c1 : (complex double)c2 : (complex float)c3 : (complex double)c4 : (complex float)c5 : (complex double)c6 : (complex float)c7 : (complex double)c8 |
︙ | ︙ | |||
142 143 144 145 146 147 148 | OF_ENSURE(creal(c15) == 15.0 && cimag(c15) == 7.5); OF_ENSURE(creal(c16) == 16.0 && cimag(c16) == 8.0); return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | OF_ENSURE(creal(c15) == 15.0 && cimag(c15) == 7.5); OF_ENSURE(creal(c16) == 16.0 && cimag(c16) == 8.0); return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } - (complex long double)invocationTestMethod7: (complex double)c1 : (complex float)c2 : (complex long double)c3 : (complex double)c4 : (complex float)c5 : (complex long double)c6 : (complex double)c7 : (complex float)c8 |
︙ | ︙ | |||
183 184 185 186 187 188 189 | return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } #endif #ifdef __SIZEOF_INT128__ __extension__ | | | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } #endif #ifdef __SIZEOF_INT128__ __extension__ - (__int128)invocationTestMethod8: (int)i1 : (__int128)i2 : (__int128)i3 : (__int128)i4 : (int)i5 : (__int128)i6 : (__int128)i7 : (__int128)i8 |
︙ | ︙ | |||
319 320 321 322 323 324 325 326 327 | } double doubleResult; TEST(@"-[invoke] #2", R([invocation invoke]) && R([invocation getReturnValue: &doubleResult]) && doubleResult == 8.5) /* Only when encoding long doubles is supported */ if (strcmp(@encode(double), @encode(long double)) != 0) { | > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | } double doubleResult; TEST(@"-[invoke] #2", R([invocation invoke]) && R([invocation getReturnValue: &doubleResult]) && doubleResult == 8.5) /* -[invoke] #3 */ selector = @selector(invocationTestMethod4::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int i = 1; i <= 16; i++) { float f = i; double d = i; if (i == 1 || i == 10) [invocation setArgument: &d atIndex: i + 1]; else [invocation setArgument: &f atIndex: i + 1]; } float floatResult; TEST(@"-[invoke] #3", R([invocation invoke]) && R([invocation getReturnValue: &floatResult]) && floatResult == 8.5) /* Only when encoding long doubles is supported */ if (strcmp(@encode(double), @encode(long double)) != 0) { /* -[invoke] #4 */ selector = @selector(invocationTestMethod5::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int i = 1; i <= 16; i++) { long double d = i; [invocation setArgument: &d atIndex: i + 1]; } long double longDoubleResult; TEST(@"-[invoke] #4", R([invocation invoke]) && R([invocation getReturnValue: &longDoubleResult]) && longDoubleResult == 8.5) } # ifndef __STDC_NO_COMPLEX__ /* -[invoke] #5 */ selector = @selector(invocationTestMethod6::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
367 368 369 370 371 372 373 | atIndex: i + 1]; else [invocation setArgument: &cd atIndex: i + 1]; } complex double complexDoubleResult; | | | | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | atIndex: i + 1]; else [invocation setArgument: &cd atIndex: i + 1]; } complex double complexDoubleResult; TEST(@"-[invoke] #5", R([invocation invoke]) && R([invocation getReturnValue: &complexDoubleResult]) && complexDoubleResult == 8.5 + 4.25 * I) /* Only when encoding complex long doubles is supported */ if (strcmp(@encode(complex double), @encode(complex long double)) != 0) { /* -[invoke] #6 */ selector = @selector(invocationTestMethod7::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
406 407 408 409 410 411 412 | [invocation setArgument: &cf atIndex: i + 1]; break; } } complex long double complexLongDoubleResult; | | | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | [invocation setArgument: &cf atIndex: i + 1]; break; } } complex long double complexLongDoubleResult; TEST(@"-[invoke] #6", R([invocation invoke]) && R([invocation getReturnValue: &complexLongDoubleResult]) && complexLongDoubleResult == 8.5 + 4.25 * I) } # endif # ifdef __SIZEOF_INT128__ /* -[invoke] #7 */ selector = @selector(invocationTestMethod8::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
437 438 439 440 441 442 443 | atIndex: i + 1]; else [invocation setArgument: &i128 atIndex: i + 1]; } __extension__ __int128 int128Result; | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | atIndex: i + 1]; else [invocation setArgument: &i128 atIndex: i + 1]; } __extension__ __int128 int128Result; TEST(@"-[invoke] #7", R([invocation invoke]) && R([invocation getReturnValue: &int128Result]) && int128Result == __extension__ ((__int128)0xFFFFFFFFFFFFFFFF << 64) + 8) # endif #endif [pool drain]; } @end |