OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/ia32/assembler-ia32.h" | 10 #include "src/ia32/assembler-ia32.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 __ maxss(i.InputDoubleRegister(0), i.InputOperand(1)); | 473 __ maxss(i.InputDoubleRegister(0), i.InputOperand(1)); |
474 break; | 474 break; |
475 case kSSEFloat32Min: | 475 case kSSEFloat32Min: |
476 __ minss(i.InputDoubleRegister(0), i.InputOperand(1)); | 476 __ minss(i.InputDoubleRegister(0), i.InputOperand(1)); |
477 break; | 477 break; |
478 case kSSEFloat32Sqrt: | 478 case kSSEFloat32Sqrt: |
479 __ sqrtss(i.OutputDoubleRegister(), i.InputOperand(0)); | 479 __ sqrtss(i.OutputDoubleRegister(), i.InputOperand(0)); |
480 break; | 480 break; |
481 case kSSEFloat32Abs: { | 481 case kSSEFloat32Abs: { |
482 // TODO(bmeurer): Use 128-bit constants. | 482 // TODO(bmeurer): Use 128-bit constants. |
483 // TODO(turbofan): Add AVX version with relaxed register constraints. | |
484 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | 483 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
485 __ psrlq(kScratchDoubleReg, 33); | 484 __ psrlq(kScratchDoubleReg, 33); |
486 __ andps(i.OutputDoubleRegister(), kScratchDoubleReg); | 485 __ andps(i.OutputDoubleRegister(), kScratchDoubleReg); |
487 break; | 486 break; |
488 } | 487 } |
489 case kSSEFloat32Neg: { | 488 case kSSEFloat32Neg: { |
490 // TODO(bmeurer): Use 128-bit constants. | 489 // TODO(bmeurer): Use 128-bit constants. |
491 // TODO(turbofan): Add AVX version with relaxed register constraints. | |
492 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | 490 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
493 __ psllq(kScratchDoubleReg, 31); | 491 __ psllq(kScratchDoubleReg, 31); |
494 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg); | 492 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg); |
495 break; | 493 break; |
496 } | 494 } |
497 case kSSEFloat64Cmp: | 495 case kSSEFloat64Cmp: |
498 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); | 496 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); |
499 break; | 497 break; |
500 case kSSEFloat64Add: | 498 case kSSEFloat64Add: |
501 __ addsd(i.InputDoubleRegister(0), i.InputOperand(1)); | 499 __ addsd(i.InputDoubleRegister(0), i.InputOperand(1)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 __ j(parity_even, &mod_loop); | 533 __ j(parity_even, &mod_loop); |
536 // Move output to stack and clean up. | 534 // Move output to stack and clean up. |
537 __ fstp(1); | 535 __ fstp(1); |
538 __ fstp_d(Operand(esp, 0)); | 536 __ fstp_d(Operand(esp, 0)); |
539 __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); | 537 __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); |
540 __ add(esp, Immediate(kDoubleSize)); | 538 __ add(esp, Immediate(kDoubleSize)); |
541 break; | 539 break; |
542 } | 540 } |
543 case kSSEFloat64Abs: { | 541 case kSSEFloat64Abs: { |
544 // TODO(bmeurer): Use 128-bit constants. | 542 // TODO(bmeurer): Use 128-bit constants. |
545 // TODO(turbofan): Add AVX version with relaxed register constraints. | |
546 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | 543 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
547 __ psrlq(kScratchDoubleReg, 1); | 544 __ psrlq(kScratchDoubleReg, 1); |
548 __ andpd(i.OutputDoubleRegister(), kScratchDoubleReg); | 545 __ andpd(i.OutputDoubleRegister(), kScratchDoubleReg); |
549 break; | 546 break; |
550 } | 547 } |
551 case kSSEFloat64Neg: { | 548 case kSSEFloat64Neg: { |
552 // TODO(bmeurer): Use 128-bit constants. | 549 // TODO(bmeurer): Use 128-bit constants. |
553 // TODO(turbofan): Add AVX version with relaxed register constraints. | |
554 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | 550 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
555 __ psllq(kScratchDoubleReg, 63); | 551 __ psllq(kScratchDoubleReg, 63); |
556 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg); | 552 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg); |
557 break; | 553 break; |
558 } | 554 } |
559 case kSSEFloat64Sqrt: | 555 case kSSEFloat64Sqrt: |
560 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0)); | 556 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0)); |
561 break; | 557 break; |
562 case kSSEFloat64Round: { | 558 case kSSEFloat64Round: { |
563 CpuFeatureScope sse_scope(masm(), SSE4_1); | 559 CpuFeatureScope sse_scope(masm(), SSE4_1); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 __ vmaxsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 672 __ vmaxsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
677 i.InputOperand(1)); | 673 i.InputOperand(1)); |
678 break; | 674 break; |
679 } | 675 } |
680 case kAVXFloat64Min: { | 676 case kAVXFloat64Min: { |
681 CpuFeatureScope avx_scope(masm(), AVX); | 677 CpuFeatureScope avx_scope(masm(), AVX); |
682 __ vminsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 678 __ vminsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
683 i.InputOperand(1)); | 679 i.InputOperand(1)); |
684 break; | 680 break; |
685 } | 681 } |
| 682 case kAVXFloat32Abs: { |
| 683 // TODO(bmeurer): Use RIP relative 128-bit constants. |
| 684 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
| 685 __ psrlq(kScratchDoubleReg, 33); |
| 686 CpuFeatureScope avx_scope(masm(), AVX); |
| 687 __ vandps(i.OutputDoubleRegister(), kScratchDoubleReg, i.InputOperand(0)); |
| 688 break; |
| 689 } |
| 690 case kAVXFloat32Neg: { |
| 691 // TODO(bmeurer): Use RIP relative 128-bit constants. |
| 692 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
| 693 __ psllq(kScratchDoubleReg, 31); |
| 694 CpuFeatureScope avx_scope(masm(), AVX); |
| 695 __ vxorps(i.OutputDoubleRegister(), kScratchDoubleReg, i.InputOperand(0)); |
| 696 break; |
| 697 } |
| 698 case kAVXFloat64Abs: { |
| 699 // TODO(bmeurer): Use RIP relative 128-bit constants. |
| 700 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
| 701 __ psrlq(kScratchDoubleReg, 1); |
| 702 CpuFeatureScope avx_scope(masm(), AVX); |
| 703 __ vandpd(i.OutputDoubleRegister(), kScratchDoubleReg, i.InputOperand(0)); |
| 704 break; |
| 705 } |
| 706 case kAVXFloat64Neg: { |
| 707 // TODO(bmeurer): Use RIP relative 128-bit constants. |
| 708 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
| 709 __ psllq(kScratchDoubleReg, 63); |
| 710 CpuFeatureScope avx_scope(masm(), AVX); |
| 711 __ vxorpd(i.OutputDoubleRegister(), kScratchDoubleReg, i.InputOperand(0)); |
| 712 break; |
| 713 } |
686 case kIA32Movsxbl: | 714 case kIA32Movsxbl: |
687 __ movsx_b(i.OutputRegister(), i.MemoryOperand()); | 715 __ movsx_b(i.OutputRegister(), i.MemoryOperand()); |
688 break; | 716 break; |
689 case kIA32Movzxbl: | 717 case kIA32Movzxbl: |
690 __ movzx_b(i.OutputRegister(), i.MemoryOperand()); | 718 __ movzx_b(i.OutputRegister(), i.MemoryOperand()); |
691 break; | 719 break; |
692 case kIA32Movb: { | 720 case kIA32Movb: { |
693 size_t index = 0; | 721 size_t index = 0; |
694 Operand operand = i.MemoryOperand(&index); | 722 Operand operand = i.MemoryOperand(&index); |
695 if (HasImmediateInput(instr, index)) { | 723 if (HasImmediateInput(instr, index)) { |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 } | 1472 } |
1445 } | 1473 } |
1446 MarkLazyDeoptSite(); | 1474 MarkLazyDeoptSite(); |
1447 } | 1475 } |
1448 | 1476 |
1449 #undef __ | 1477 #undef __ |
1450 | 1478 |
1451 } // namespace compiler | 1479 } // namespace compiler |
1452 } // namespace internal | 1480 } // namespace internal |
1453 } // namespace v8 | 1481 } // namespace v8 |
OLD | NEW |