OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 int32_t lower = static_cast<int32_t>(int_val); | 319 int32_t lower = static_cast<int32_t>(int_val); |
320 int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt); | 320 int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt); |
321 if (CpuFeatures::IsSupported(SSE2)) { | 321 if (CpuFeatures::IsSupported(SSE2)) { |
322 CpuFeatureScope scope(cgen_->masm(), SSE2); | 322 CpuFeatureScope scope(cgen_->masm(), SSE2); |
323 XMMRegister dst = cgen_->ToDoubleRegister(destination); | 323 XMMRegister dst = cgen_->ToDoubleRegister(destination); |
324 if (int_val == 0) { | 324 if (int_val == 0) { |
325 __ xorps(dst, dst); | 325 __ xorps(dst, dst); |
326 } else { | 326 } else { |
327 __ push(Immediate(upper)); | 327 __ push(Immediate(upper)); |
328 __ push(Immediate(lower)); | 328 __ push(Immediate(lower)); |
329 __ movdbl(dst, Operand(esp, 0)); | 329 __ movsd(dst, Operand(esp, 0)); |
330 __ add(esp, Immediate(kDoubleSize)); | 330 __ add(esp, Immediate(kDoubleSize)); |
331 } | 331 } |
332 } else { | 332 } else { |
333 __ push(Immediate(upper)); | 333 __ push(Immediate(upper)); |
334 __ push(Immediate(lower)); | 334 __ push(Immediate(lower)); |
335 X87Register dst = cgen_->ToX87Register(destination); | 335 X87Register dst = cgen_->ToX87Register(destination); |
336 cgen_->X87Mov(dst, MemOperand(esp, 0)); | 336 cgen_->X87Mov(dst, MemOperand(esp, 0)); |
337 __ add(esp, Immediate(kDoubleSize)); | 337 __ add(esp, Immediate(kDoubleSize)); |
338 } | 338 } |
339 } else { | 339 } else { |
(...skipping 13 matching lines...) Expand all Loading... |
353 } else if (source->IsDoubleRegister()) { | 353 } else if (source->IsDoubleRegister()) { |
354 if (CpuFeatures::IsSupported(SSE2)) { | 354 if (CpuFeatures::IsSupported(SSE2)) { |
355 CpuFeatureScope scope(cgen_->masm(), SSE2); | 355 CpuFeatureScope scope(cgen_->masm(), SSE2); |
356 XMMRegister src = cgen_->ToDoubleRegister(source); | 356 XMMRegister src = cgen_->ToDoubleRegister(source); |
357 if (destination->IsDoubleRegister()) { | 357 if (destination->IsDoubleRegister()) { |
358 XMMRegister dst = cgen_->ToDoubleRegister(destination); | 358 XMMRegister dst = cgen_->ToDoubleRegister(destination); |
359 __ movaps(dst, src); | 359 __ movaps(dst, src); |
360 } else { | 360 } else { |
361 ASSERT(destination->IsDoubleStackSlot()); | 361 ASSERT(destination->IsDoubleStackSlot()); |
362 Operand dst = cgen_->ToOperand(destination); | 362 Operand dst = cgen_->ToOperand(destination); |
363 __ movdbl(dst, src); | 363 __ movsd(dst, src); |
364 } | 364 } |
365 } else { | 365 } else { |
366 // load from the register onto the stack, store in destination, which must | 366 // load from the register onto the stack, store in destination, which must |
367 // be a double stack slot in the non-SSE2 case. | 367 // be a double stack slot in the non-SSE2 case. |
368 ASSERT(destination->IsDoubleStackSlot()); | 368 ASSERT(destination->IsDoubleStackSlot()); |
369 Operand dst = cgen_->ToOperand(destination); | 369 Operand dst = cgen_->ToOperand(destination); |
370 X87Register src = cgen_->ToX87Register(source); | 370 X87Register src = cgen_->ToX87Register(source); |
371 cgen_->X87Mov(dst, src); | 371 cgen_->X87Mov(dst, src); |
372 } | 372 } |
373 } else if (source->IsDoubleStackSlot()) { | 373 } else if (source->IsDoubleStackSlot()) { |
374 if (CpuFeatures::IsSupported(SSE2)) { | 374 if (CpuFeatures::IsSupported(SSE2)) { |
375 CpuFeatureScope scope(cgen_->masm(), SSE2); | 375 CpuFeatureScope scope(cgen_->masm(), SSE2); |
376 ASSERT(destination->IsDoubleRegister() || | 376 ASSERT(destination->IsDoubleRegister() || |
377 destination->IsDoubleStackSlot()); | 377 destination->IsDoubleStackSlot()); |
378 Operand src = cgen_->ToOperand(source); | 378 Operand src = cgen_->ToOperand(source); |
379 if (destination->IsDoubleRegister()) { | 379 if (destination->IsDoubleRegister()) { |
380 XMMRegister dst = cgen_->ToDoubleRegister(destination); | 380 XMMRegister dst = cgen_->ToDoubleRegister(destination); |
381 __ movdbl(dst, src); | 381 __ movsd(dst, src); |
382 } else { | 382 } else { |
383 // We rely on having xmm0 available as a fixed scratch register. | 383 // We rely on having xmm0 available as a fixed scratch register. |
384 Operand dst = cgen_->ToOperand(destination); | 384 Operand dst = cgen_->ToOperand(destination); |
385 __ movdbl(xmm0, src); | 385 __ movsd(xmm0, src); |
386 __ movdbl(dst, xmm0); | 386 __ movsd(dst, xmm0); |
387 } | 387 } |
388 } else { | 388 } else { |
389 // load from the stack slot on top of the floating point stack, and then | 389 // load from the stack slot on top of the floating point stack, and then |
390 // store in destination. If destination is a double register, then it | 390 // store in destination. If destination is a double register, then it |
391 // represents the top of the stack and nothing needs to be done. | 391 // represents the top of the stack and nothing needs to be done. |
392 if (destination->IsDoubleStackSlot()) { | 392 if (destination->IsDoubleStackSlot()) { |
393 Register tmp = EnsureTempRegister(); | 393 Register tmp = EnsureTempRegister(); |
394 Operand src0 = cgen_->ToOperand(source); | 394 Operand src0 = cgen_->ToOperand(source); |
395 Operand src1 = cgen_->HighOperand(source); | 395 Operand src1 = cgen_->HighOperand(source); |
396 Operand dst0 = cgen_->ToOperand(destination); | 396 Operand dst0 = cgen_->ToOperand(destination); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { | 479 } else if (source->IsDoubleRegister() || destination->IsDoubleRegister()) { |
480 CpuFeatureScope scope(cgen_->masm(), SSE2); | 480 CpuFeatureScope scope(cgen_->masm(), SSE2); |
481 // XMM register-memory swap. We rely on having xmm0 | 481 // XMM register-memory swap. We rely on having xmm0 |
482 // available as a fixed scratch register. | 482 // available as a fixed scratch register. |
483 ASSERT(source->IsDoubleStackSlot() || destination->IsDoubleStackSlot()); | 483 ASSERT(source->IsDoubleStackSlot() || destination->IsDoubleStackSlot()); |
484 XMMRegister reg = cgen_->ToDoubleRegister(source->IsDoubleRegister() | 484 XMMRegister reg = cgen_->ToDoubleRegister(source->IsDoubleRegister() |
485 ? source | 485 ? source |
486 : destination); | 486 : destination); |
487 Operand other = | 487 Operand other = |
488 cgen_->ToOperand(source->IsDoubleRegister() ? destination : source); | 488 cgen_->ToOperand(source->IsDoubleRegister() ? destination : source); |
489 __ movdbl(xmm0, other); | 489 __ movsd(xmm0, other); |
490 __ movdbl(other, reg); | 490 __ movsd(other, reg); |
491 __ movdbl(reg, Operand(xmm0)); | 491 __ movsd(reg, Operand(xmm0)); |
492 } else if (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot()) { | 492 } else if (source->IsDoubleStackSlot() && destination->IsDoubleStackSlot()) { |
493 CpuFeatureScope scope(cgen_->masm(), SSE2); | 493 CpuFeatureScope scope(cgen_->masm(), SSE2); |
494 // Double-width memory-to-memory. Spill on demand to use a general | 494 // Double-width memory-to-memory. Spill on demand to use a general |
495 // purpose temporary register and also rely on having xmm0 available as | 495 // purpose temporary register and also rely on having xmm0 available as |
496 // a fixed scratch register. | 496 // a fixed scratch register. |
497 Register tmp = EnsureTempRegister(); | 497 Register tmp = EnsureTempRegister(); |
498 Operand src0 = cgen_->ToOperand(source); | 498 Operand src0 = cgen_->ToOperand(source); |
499 Operand src1 = cgen_->HighOperand(source); | 499 Operand src1 = cgen_->HighOperand(source); |
500 Operand dst0 = cgen_->ToOperand(destination); | 500 Operand dst0 = cgen_->ToOperand(destination); |
501 Operand dst1 = cgen_->HighOperand(destination); | 501 Operand dst1 = cgen_->HighOperand(destination); |
502 __ movdbl(xmm0, dst0); // Save destination in xmm0. | 502 __ movsd(xmm0, dst0); // Save destination in xmm0. |
503 __ mov(tmp, src0); // Then use tmp to copy source to destination. | 503 __ mov(tmp, src0); // Then use tmp to copy source to destination. |
504 __ mov(dst0, tmp); | 504 __ mov(dst0, tmp); |
505 __ mov(tmp, src1); | 505 __ mov(tmp, src1); |
506 __ mov(dst1, tmp); | 506 __ mov(dst1, tmp); |
507 __ movdbl(src0, xmm0); | 507 __ movsd(src0, xmm0); |
508 | 508 |
509 } else { | 509 } else { |
510 // No other combinations are possible. | 510 // No other combinations are possible. |
511 UNREACHABLE(); | 511 UNREACHABLE(); |
512 } | 512 } |
513 | 513 |
514 // The swap of source and destination has executed a move from source to | 514 // The swap of source and destination has executed a move from source to |
515 // destination. | 515 // destination. |
516 RemoveMove(index); | 516 RemoveMove(index); |
517 | 517 |
(...skipping 22 matching lines...) Expand all Loading... |
540 } else if (destination->IsRegister()) { | 540 } else if (destination->IsRegister()) { |
541 source_uses_[destination->index()] = CountSourceUses(destination); | 541 source_uses_[destination->index()] = CountSourceUses(destination); |
542 } | 542 } |
543 } | 543 } |
544 | 544 |
545 #undef __ | 545 #undef __ |
546 | 546 |
547 } } // namespace v8::internal | 547 } } // namespace v8::internal |
548 | 548 |
549 #endif // V8_TARGET_ARCH_IA32 | 549 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |