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