Differences From Artifact [2253358a2d]:
- File
src/invocation/invoke-x86_64.m
— part of check-in
[15eed89995]
at
2017-09-17 02:20:44
on branch trunk
— invoke-x86_64.m: Change __int128 handling
When using GCC (and thus conforming to the ABI), do not pass the low
half of an __int128 in a register while passing the high of an __int128
on the stack.For Clang, just handle it as two longs. (user: js, size: 8224) [annotate] [blame] [check-ins using]
To Artifact [567ef57186]:
- File src/invocation/invoke-x86_64.m — part of check-in [b35074d74a] at 2017-09-17 03:18:26 on branch trunk — invoke-x86_64.m: Support complex {float,double} (user: js, size: 10499) [annotate] [blame] [check-ins using]
︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | sizeof(**context) + ((*context)->stack_size + 1) * 8]; } memcpy(&newContext->stack[newContext->stack_size], &value, 8); newContext->stack_size++; *context = newContext; } static void pushQuad(struct call_context **context, uint_fast8_t *currentSSE, double low, double high) { size_t stackSize; struct call_context *newContext; if (*currentSSE + 1 < NUM_SSE_IN) { (*context)->sse[(*currentSSE)++] = (__m128)_mm_set_sd(low); (*context)->sse[(*currentSSE)++] = (__m128)_mm_set_sd(high); (*context)->num_sse_used += 2; return; } stackSize = (*context)->stack_size + 2; if ((newContext = realloc(*context, sizeof(**context) + stackSize * 8)) == NULL) { free(*context); @throw [OFOutOfMemoryException exceptionWithRequestedSize: sizeof(**context) + stackSize * 8]; } memset(&newContext->stack[newContext->stack_size], '\0', (stackSize - newContext->stack_size) * 8); memcpy(&newContext->stack[stackSize - 2], &low, 8); memcpy(&newContext->stack[stackSize - 1], &high, 8); newContext->stack_size = stackSize; *context = newContext; } static void pushLongDouble(struct call_context **context, long double value) { struct call_context *newContext; if ((newContext = realloc(*context, |
︙ | |||
117 118 119 120 121 122 123 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | - + | } #if defined(__SIZEOF_INT128__) && !defined(__clang__) static void pushInt128(struct call_context **context, uint_fast8_t *currentGPR, uint64_t low, uint64_t high) { |
︙ | |||
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | + + + + + + + | CASE_GPR('I', unsigned int) CASE_GPR('s', short) CASE_GPR('S', unsigned short) CASE_GPR('l', long) CASE_GPR('L', unsigned long) CASE_GPR('q', long long) CASE_GPR('Q', unsigned long long) CASE_GPR('B', _Bool) CASE_GPR('*', uintptr_t) CASE_GPR('@', uintptr_t) CASE_GPR('#', uintptr_t) CASE_GPR(':', uintptr_t) CASE_GPR('^', uintptr_t) #ifdef __SIZEOF_INT128__ case 't': case 'T':; struct { uint64_t low, high; } int128Tmp; [invocation getArgument: &int128Tmp atIndex: i]; # ifndef __clang__ pushInt128(&context, ¤tGPR, int128Tmp.low, int128Tmp.high); # else /* See https://bugs.llvm.org/show_bug.cgi?id=34646 */ pushGPR(&context, ¤tGPR, int128Tmp.low); pushGPR(&context, ¤tGPR, int128Tmp.high); # endif break; #endif case 'f':; float floatTmp; |
︙ | |||
217 218 219 220 221 222 223 | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - | break; case 'D':; long double longDoubleTmp; [invocation getArgument: &longDoubleTmp atIndex: i]; pushLongDouble(&context, longDoubleTmp); break; |
︙ | |||
252 253 254 255 256 257 258 | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - | case 'I': case 's': case 'S': case 'l': case 'L': case 'q': case 'Q': |
︙ | |||
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | 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 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - | CASE_GPR('I', unsigned int) CASE_GPR('s', short) CASE_GPR('S', unsigned short) CASE_GPR('l', long) CASE_GPR('L', unsigned long) CASE_GPR('q', long long) CASE_GPR('Q', unsigned long long) CASE_GPR('B', _Bool) CASE_GPR('*', uintptr_t) CASE_GPR('@', uintptr_t) CASE_GPR('#', uintptr_t) CASE_GPR(':', uintptr_t) CASE_GPR('^', uintptr_t) #ifdef __SIZEOF_INT128__ case 't': case 'T':; [invocation setReturnValue: &context->gpr[NUM_GPR_IN]]; break; #endif case 'f':; float floatTmp; _mm_store_ss(&floatTmp, context->sse[0]); [invocation setReturnValue: &floatTmp]; break; case 'd':; double doubleTmp; _mm_store_sd(&doubleTmp, (__m128d)context->sse[0]); [invocation setReturnValue: &doubleTmp]; break; case 'D': [invocation setReturnValue: &context->x87[0]]; break; |