| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 break; | 647 break; |
| 648 } | 648 } |
| 649 case kSSEFloat32Neg: { | 649 case kSSEFloat32Neg: { |
| 650 // TODO(bmeurer): Use 128-bit constants. | 650 // TODO(bmeurer): Use 128-bit constants. |
| 651 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | 651 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
| 652 __ psllq(kScratchDoubleReg, 31); | 652 __ psllq(kScratchDoubleReg, 31); |
| 653 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg); | 653 __ xorps(i.OutputDoubleRegister(), kScratchDoubleReg); |
| 654 break; | 654 break; |
| 655 } | 655 } |
| 656 case kSSEFloat32Round: { | 656 case kSSEFloat32Round: { |
| 657 CpuFeatureScope sse_scope(masm(), SSE4_1); |
| 657 RoundingMode const mode = | 658 RoundingMode const mode = |
| 658 static_cast<RoundingMode>(MiscField::decode(instr->opcode())); | 659 static_cast<RoundingMode>(MiscField::decode(instr->opcode())); |
| 659 if (CpuFeatures::IsSupported(SSE4_1)) { | |
| 660 CpuFeatureScope sse_scope(masm(), SSE4_1); | |
| 661 __ roundss(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode); | 660 __ roundss(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode); |
| 662 } else { | |
| 663 Register scratch = i.TempRegister(0); | |
| 664 __ Roundss(i.OutputDoubleRegister(), i.InputDoubleRegister(0), scratch, | |
| 665 mode); | |
| 666 } | |
| 667 break; | 661 break; |
| 668 } | 662 } |
| 669 case kSSEFloat64Cmp: | 663 case kSSEFloat64Cmp: |
| 670 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); | 664 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); |
| 671 break; | 665 break; |
| 672 case kSSEFloat64Add: | 666 case kSSEFloat64Add: |
| 673 __ addsd(i.InputDoubleRegister(0), i.InputOperand(1)); | 667 __ addsd(i.InputDoubleRegister(0), i.InputOperand(1)); |
| 674 break; | 668 break; |
| 675 case kSSEFloat64Sub: | 669 case kSSEFloat64Sub: |
| 676 __ subsd(i.InputDoubleRegister(0), i.InputOperand(1)); | 670 __ subsd(i.InputDoubleRegister(0), i.InputOperand(1)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 // TODO(bmeurer): Use 128-bit constants. | 720 // TODO(bmeurer): Use 128-bit constants. |
| 727 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); | 721 __ pcmpeqd(kScratchDoubleReg, kScratchDoubleReg); |
| 728 __ psllq(kScratchDoubleReg, 63); | 722 __ psllq(kScratchDoubleReg, 63); |
| 729 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg); | 723 __ xorpd(i.OutputDoubleRegister(), kScratchDoubleReg); |
| 730 break; | 724 break; |
| 731 } | 725 } |
| 732 case kSSEFloat64Sqrt: | 726 case kSSEFloat64Sqrt: |
| 733 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0)); | 727 __ sqrtsd(i.OutputDoubleRegister(), i.InputOperand(0)); |
| 734 break; | 728 break; |
| 735 case kSSEFloat64Round: { | 729 case kSSEFloat64Round: { |
| 730 CpuFeatureScope sse_scope(masm(), SSE4_1); |
| 736 RoundingMode const mode = | 731 RoundingMode const mode = |
| 737 static_cast<RoundingMode>(MiscField::decode(instr->opcode())); | 732 static_cast<RoundingMode>(MiscField::decode(instr->opcode())); |
| 738 if (CpuFeatures::IsSupported(SSE4_1)) { | 733 __ roundsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode); |
| 739 CpuFeatureScope sse_scope(masm(), SSE4_1); | |
| 740 __ roundsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), mode); | |
| 741 } else { | |
| 742 Register scratch = i.TempRegister(0); | |
| 743 __ Roundsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), scratch, | |
| 744 kScratchDoubleReg, mode); | |
| 745 } | |
| 746 break; | 734 break; |
| 747 } | 735 } |
| 748 case kSSEFloat32ToFloat64: | 736 case kSSEFloat32ToFloat64: |
| 749 __ cvtss2sd(i.OutputDoubleRegister(), i.InputOperand(0)); | 737 __ cvtss2sd(i.OutputDoubleRegister(), i.InputOperand(0)); |
| 750 break; | 738 break; |
| 751 case kSSEFloat64ToFloat32: | 739 case kSSEFloat64ToFloat32: |
| 752 __ cvtsd2ss(i.OutputDoubleRegister(), i.InputOperand(0)); | 740 __ cvtsd2ss(i.OutputDoubleRegister(), i.InputOperand(0)); |
| 753 break; | 741 break; |
| 754 case kSSEFloat32ToInt32: | 742 case kSSEFloat32ToInt32: |
| 755 __ cvttss2si(i.OutputRegister(), i.InputOperand(0)); | 743 __ cvttss2si(i.OutputRegister(), i.InputOperand(0)); |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1703 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 1716 __ Nop(padding_size); | 1704 __ Nop(padding_size); |
| 1717 } | 1705 } |
| 1718 } | 1706 } |
| 1719 | 1707 |
| 1720 #undef __ | 1708 #undef __ |
| 1721 | 1709 |
| 1722 } // namespace compiler | 1710 } // namespace compiler |
| 1723 } // namespace internal | 1711 } // namespace internal |
| 1724 } // namespace v8 | 1712 } // namespace v8 |
| OLD | NEW |