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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 __ mov(tmp, src0); // Then use tmp to copy source to destination. | 398 __ mov(tmp, src0); // Then use tmp to copy source to destination. |
399 __ mov(dst0, tmp); | 399 __ mov(dst0, tmp); |
400 __ mov(tmp, src1); | 400 __ mov(tmp, src1); |
401 __ mov(dst1, tmp); | 401 __ mov(dst1, tmp); |
402 } else { | 402 } else { |
403 Operand src = cgen_->ToOperand(source); | 403 Operand src = cgen_->ToOperand(source); |
404 X87Register dst = cgen_->ToX87Register(destination); | 404 X87Register dst = cgen_->ToX87Register(destination); |
405 cgen_->X87Mov(dst, src); | 405 cgen_->X87Mov(dst, src); |
406 } | 406 } |
407 } | 407 } |
| 408 } else if (source->IsFloat32x4Register() || source->IsInt32x4Register()) { |
| 409 ASSERT(CpuFeatures::IsSupported(SSE2)); |
| 410 CpuFeatureScope scope(cgen_->masm(), SSE2); |
| 411 XMMRegister src = cgen_->ToXMMRegister(source); |
| 412 if (destination->IsFloat32x4Register() || |
| 413 destination->IsInt32x4Register()) { |
| 414 __ movaps(cgen_->ToXMMRegister(destination), src); |
| 415 } else { |
| 416 ASSERT(destination->IsFloat32x4StackSlot() || |
| 417 destination->IsInt32x4StackSlot()); |
| 418 __ movups(cgen_->ToOperand(destination), src); |
| 419 } |
| 420 } else if (source->IsFloat32x4StackSlot() || source->IsInt32x4StackSlot()) { |
| 421 ASSERT(CpuFeatures::IsSupported(SSE2)); |
| 422 CpuFeatureScope scope(cgen_->masm(), SSE2); |
| 423 Operand src = cgen_->ToOperand(source); |
| 424 if (destination->IsFloat32x4Register() || |
| 425 destination->IsInt32x4Register()) { |
| 426 __ movups(cgen_->ToXMMRegister(destination), src); |
| 427 } else { |
| 428 ASSERT(destination->IsFloat32x4StackSlot() || |
| 429 destination->IsInt32x4StackSlot()); |
| 430 __ movups(xmm0, src); |
| 431 __ movups(cgen_->ToOperand(destination), xmm0); |
| 432 } |
408 } else { | 433 } else { |
409 UNREACHABLE(); | 434 UNREACHABLE(); |
410 } | 435 } |
411 | 436 |
412 RemoveMove(index); | 437 RemoveMove(index); |
413 } | 438 } |
414 | 439 |
415 | 440 |
416 void LGapResolver::EmitSwap(int index) { | 441 void LGapResolver::EmitSwap(int index) { |
417 LOperand* source = moves_[index].source(); | 442 LOperand* source = moves_[index].source(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 Operand src1 = cgen_->HighOperand(source); | 524 Operand src1 = cgen_->HighOperand(source); |
500 Operand dst0 = cgen_->ToOperand(destination); | 525 Operand dst0 = cgen_->ToOperand(destination); |
501 Operand dst1 = cgen_->HighOperand(destination); | 526 Operand dst1 = cgen_->HighOperand(destination); |
502 __ movsd(xmm0, dst0); // Save destination in xmm0. | 527 __ movsd(xmm0, dst0); // Save destination in xmm0. |
503 __ mov(tmp, src0); // Then use tmp to copy source to destination. | 528 __ mov(tmp, src0); // Then use tmp to copy source to destination. |
504 __ mov(dst0, tmp); | 529 __ mov(dst0, tmp); |
505 __ mov(tmp, src1); | 530 __ mov(tmp, src1); |
506 __ mov(dst1, tmp); | 531 __ mov(dst1, tmp); |
507 __ movsd(src0, xmm0); | 532 __ movsd(src0, xmm0); |
508 | 533 |
| 534 } else if ((source->IsFloat32x4Register() && |
| 535 destination->IsFloat32x4Register()) || |
| 536 (source->IsInt32x4Register() && |
| 537 destination->IsInt32x4Register())) { |
| 538 // Swap two XMM registers. |
| 539 XMMRegister source_reg = cgen_->ToXMMRegister(source); |
| 540 XMMRegister destination_reg = cgen_->ToXMMRegister(destination); |
| 541 __ movaps(xmm0, source_reg); |
| 542 __ movaps(source_reg, destination_reg); |
| 543 __ movaps(destination_reg, xmm0); |
| 544 |
| 545 } else if ((source->IsFloat32x4Register() || |
| 546 destination->IsFloat32x4Register()) || |
| 547 (source->IsInt32x4Register() || |
| 548 destination->IsInt32x4Register())) { |
| 549 // Swap a xmm register and a xmm stack slot. |
| 550 ASSERT((source->IsFloat32x4Register() && |
| 551 destination->IsFloat32x4StackSlot()) || |
| 552 (source->IsFloat32x4StackSlot() && |
| 553 destination->IsFloat32x4Register()) || |
| 554 (source->IsInt32x4Register() && |
| 555 destination->IsInt32x4StackSlot()) || |
| 556 (source->IsInt32x4StackSlot() && |
| 557 destination->IsInt32x4Register())); |
| 558 XMMRegister reg = cgen_->ToXMMRegister((source->IsFloat32x4Register() || |
| 559 source->IsInt32x4Register()) |
| 560 ? source |
| 561 : destination); |
| 562 LOperand* other = (source->IsFloat32x4Register() || |
| 563 source->IsInt32x4Register()) |
| 564 ? destination |
| 565 : source; |
| 566 ASSERT(other->IsFloat32x4StackSlot() || other->IsInt32x4StackSlot()); |
| 567 Operand other_operand = cgen_->ToOperand(other); |
| 568 __ movups(xmm0, other_operand); |
| 569 __ movups(other_operand, reg); |
| 570 __ movaps(reg, xmm0); |
| 571 |
| 572 } else if ((source->IsFloat32x4StackSlot() && |
| 573 destination->IsFloat32x4StackSlot()) || |
| 574 (source->IsInt32x4StackSlot() && |
| 575 destination->IsInt32x4StackSlot())) { |
| 576 // Swap two XMM stack slots. |
| 577 Operand src = cgen_->ToOperand(source); |
| 578 Operand dst = cgen_->ToOperand(destination); |
| 579 Register tmp = EnsureTempRegister(); |
| 580 __ movups(xmm0, src); |
| 581 for (int offset = 0; offset < kFloat32x4Size; offset += kFloatSize) { |
| 582 __ mov(tmp, Operand(dst, offset)); |
| 583 __ mov(Operand(src, offset), tmp); |
| 584 } |
| 585 __ movups(dst, xmm0); |
| 586 |
509 } else { | 587 } else { |
510 // No other combinations are possible. | 588 // No other combinations are possible. |
511 UNREACHABLE(); | 589 UNREACHABLE(); |
512 } | 590 } |
513 | 591 |
514 // The swap of source and destination has executed a move from source to | 592 // The swap of source and destination has executed a move from source to |
515 // destination. | 593 // destination. |
516 RemoveMove(index); | 594 RemoveMove(index); |
517 | 595 |
518 // Any unperformed (including pending) move with a source of either | 596 // Any unperformed (including pending) move with a source of either |
(...skipping 21 matching lines...) Expand all Loading... |
540 } else if (destination->IsRegister()) { | 618 } else if (destination->IsRegister()) { |
541 source_uses_[destination->index()] = CountSourceUses(destination); | 619 source_uses_[destination->index()] = CountSourceUses(destination); |
542 } | 620 } |
543 } | 621 } |
544 | 622 |
545 #undef __ | 623 #undef __ |
546 | 624 |
547 } } // namespace v8::internal | 625 } } // namespace v8::internal |
548 | 626 |
549 #endif // V8_TARGET_ARCH_IA32 | 627 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |