| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2748 summary->set_out(Location::RequiresFpuRegister()); | 2748 summary->set_out(Location::RequiresFpuRegister()); |
| 2749 return summary; | 2749 return summary; |
| 2750 } | 2750 } |
| 2751 | 2751 |
| 2752 | 2752 |
| 2753 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2753 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2754 const intptr_t value_cid = value()->Type()->ToCid(); | 2754 const intptr_t value_cid = value()->Type()->ToCid(); |
| 2755 const Register value = locs()->in(0).reg(); | 2755 const Register value = locs()->in(0).reg(); |
| 2756 const XmmRegister result = locs()->out().fpu_reg(); | 2756 const XmmRegister result = locs()->out().fpu_reg(); |
| 2757 | 2757 |
| 2758 ASSERT(value_cid == kFloat32x4Cid); | 2758 if (value_cid != kFloat32x4Cid) { |
| 2759 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptCheckClass); |
| 2760 __ testq(value, Immediate(kSmiTagMask)); |
| 2761 __ j(ZERO, deopt); |
| 2762 __ CompareClassId(value, kFloat32x4Cid); |
| 2763 __ j(NOT_EQUAL, deopt); |
| 2764 } |
| 2759 __ movups(result, FieldAddress(value, Float32x4::value_offset())); | 2765 __ movups(result, FieldAddress(value, Float32x4::value_offset())); |
| 2760 } | 2766 } |
| 2761 | 2767 |
| 2762 | 2768 |
| 2769 LocationSummary* BoxUint32x4Instr::MakeLocationSummary() const { |
| 2770 const intptr_t kNumInputs = 1; |
| 2771 const intptr_t kNumTemps = 0; |
| 2772 LocationSummary* summary = |
| 2773 new LocationSummary(kNumInputs, |
| 2774 kNumTemps, |
| 2775 LocationSummary::kCallOnSlowPath); |
| 2776 summary->set_in(0, Location::RequiresFpuRegister()); |
| 2777 summary->set_out(Location::RequiresRegister()); |
| 2778 return summary; |
| 2779 } |
| 2780 |
| 2781 |
| 2782 class BoxUint32x4SlowPath : public SlowPathCode { |
| 2783 public: |
| 2784 explicit BoxUint32x4SlowPath(BoxUint32x4Instr* instruction) |
| 2785 : instruction_(instruction) { } |
| 2786 |
| 2787 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2788 __ Comment("BoxUint32x4SlowPath"); |
| 2789 __ Bind(entry_label()); |
| 2790 const Class& uint32x4_class = compiler->uint32x4_class(); |
| 2791 const Code& stub = |
| 2792 Code::Handle(StubCode::GetAllocationStubForClass(uint32x4_class)); |
| 2793 const ExternalLabel label(uint32x4_class.ToCString(), stub.EntryPoint()); |
| 2794 |
| 2795 LocationSummary* locs = instruction_->locs(); |
| 2796 locs->live_registers()->Remove(locs->out()); |
| 2797 |
| 2798 compiler->SaveLiveRegisters(locs); |
| 2799 compiler->GenerateCall(Scanner::kDummyTokenIndex, // No token position. |
| 2800 &label, |
| 2801 PcDescriptors::kOther, |
| 2802 locs); |
| 2803 __ MoveRegister(locs->out().reg(), RAX); |
| 2804 compiler->RestoreLiveRegisters(locs); |
| 2805 |
| 2806 __ jmp(exit_label()); |
| 2807 } |
| 2808 |
| 2809 private: |
| 2810 BoxUint32x4Instr* instruction_; |
| 2811 }; |
| 2812 |
| 2813 |
| 2814 void BoxUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2815 BoxUint32x4SlowPath* slow_path = new BoxUint32x4SlowPath(this); |
| 2816 compiler->AddSlowPathCode(slow_path); |
| 2817 |
| 2818 Register out_reg = locs()->out().reg(); |
| 2819 XmmRegister value = locs()->in(0).fpu_reg(); |
| 2820 |
| 2821 __ TryAllocate(compiler->uint32x4_class(), |
| 2822 slow_path->entry_label(), |
| 2823 Assembler::kFarJump, |
| 2824 out_reg); |
| 2825 __ Bind(slow_path->exit_label()); |
| 2826 __ movups(FieldAddress(out_reg, Uint32x4::value_offset()), value); |
| 2827 } |
| 2828 |
| 2829 |
| 2830 LocationSummary* UnboxUint32x4Instr::MakeLocationSummary() const { |
| 2831 const intptr_t kNumInputs = 1; |
| 2832 const intptr_t kNumTemps = 0; |
| 2833 LocationSummary* summary = |
| 2834 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2835 summary->set_in(0, Location::RequiresRegister()); |
| 2836 summary->set_out(Location::RequiresFpuRegister()); |
| 2837 return summary; |
| 2838 } |
| 2839 |
| 2840 |
| 2841 void UnboxUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2842 const intptr_t value_cid = value()->Type()->ToCid(); |
| 2843 const Register value = locs()->in(0).reg(); |
| 2844 const XmmRegister result = locs()->out().fpu_reg(); |
| 2845 |
| 2846 if (value_cid != kUint32x4Cid) { |
| 2847 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptCheckClass); |
| 2848 __ testq(value, Immediate(kSmiTagMask)); |
| 2849 __ j(ZERO, deopt); |
| 2850 __ CompareClassId(value, kUint32x4Cid); |
| 2851 __ j(NOT_EQUAL, deopt); |
| 2852 } |
| 2853 __ movups(result, FieldAddress(value, Uint32x4::value_offset())); |
| 2854 } |
| 2855 |
| 2856 |
| 2763 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary() const { | 2857 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary() const { |
| 2764 const intptr_t kNumInputs = 2; | 2858 const intptr_t kNumInputs = 2; |
| 2765 const intptr_t kNumTemps = 0; | 2859 const intptr_t kNumTemps = 0; |
| 2766 LocationSummary* summary = | 2860 LocationSummary* summary = |
| 2767 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2861 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2768 summary->set_in(0, Location::RequiresFpuRegister()); | 2862 summary->set_in(0, Location::RequiresFpuRegister()); |
| 2769 summary->set_in(1, Location::RequiresFpuRegister()); | 2863 summary->set_in(1, Location::RequiresFpuRegister()); |
| 2770 summary->set_out(Location::SameAsFirstInput()); | 2864 summary->set_out(Location::SameAsFirstInput()); |
| 2771 return summary; | 2865 return summary; |
| 2772 } | 2866 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2933 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3027 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2934 XmmRegister value = locs()->out().fpu_reg(); | 3028 XmmRegister value = locs()->out().fpu_reg(); |
| 2935 ASSERT(locs()->in(0).fpu_reg() == locs()->out().fpu_reg()); | 3029 ASSERT(locs()->in(0).fpu_reg() == locs()->out().fpu_reg()); |
| 2936 // Convert to Float32. | 3030 // Convert to Float32. |
| 2937 __ cvtsd2ss(value, value); | 3031 __ cvtsd2ss(value, value); |
| 2938 // Splat across all lanes. | 3032 // Splat across all lanes. |
| 2939 __ shufps(value, value, Immediate(0x00)); | 3033 __ shufps(value, value, Immediate(0x00)); |
| 2940 } | 3034 } |
| 2941 | 3035 |
| 2942 | 3036 |
| 3037 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary() const { |
| 3038 const intptr_t kNumInputs = 2; |
| 3039 const intptr_t kNumTemps = 0; |
| 3040 LocationSummary* summary = |
| 3041 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3042 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3043 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3044 summary->set_out(Location::SameAsFirstInput()); |
| 3045 return summary; |
| 3046 } |
| 3047 |
| 3048 |
| 3049 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3050 XmmRegister left = locs()->in(0).fpu_reg(); |
| 3051 XmmRegister right = locs()->in(1).fpu_reg(); |
| 3052 |
| 3053 ASSERT(locs()->out().fpu_reg() == left); |
| 3054 |
| 3055 switch (op_kind()) { |
| 3056 case MethodRecognizer::kFloat32x4Equal: |
| 3057 __ cmppseq(left, right); |
| 3058 break; |
| 3059 case MethodRecognizer::kFloat32x4NotEqual: |
| 3060 __ cmppsneq(left, right); |
| 3061 break; |
| 3062 case MethodRecognizer::kFloat32x4GreaterThan: |
| 3063 __ cmppsnle(left, right); |
| 3064 break; |
| 3065 case MethodRecognizer::kFloat32x4GreaterThanOrEqual: |
| 3066 __ cmppsnlt(left, right); |
| 3067 break; |
| 3068 case MethodRecognizer::kFloat32x4LessThan: |
| 3069 __ cmppslt(left, right); |
| 3070 break; |
| 3071 case MethodRecognizer::kFloat32x4LessThanOrEqual: |
| 3072 __ cmppsle(left, right); |
| 3073 break; |
| 3074 |
| 3075 default: UNREACHABLE(); |
| 3076 } |
| 3077 } |
| 3078 |
| 3079 |
| 2943 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { | 3080 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { |
| 2944 const intptr_t kNumInputs = 1; | 3081 const intptr_t kNumInputs = 1; |
| 2945 const intptr_t kNumTemps = 0; | 3082 const intptr_t kNumTemps = 0; |
| 2946 LocationSummary* summary = | 3083 LocationSummary* summary = |
| 2947 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3084 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2948 summary->set_in(0, Location::RequiresFpuRegister()); | 3085 summary->set_in(0, Location::RequiresFpuRegister()); |
| 2949 summary->set_out(Location::RequiresFpuRegister()); | 3086 summary->set_out(Location::RequiresFpuRegister()); |
| 2950 return summary; | 3087 return summary; |
| 2951 } | 3088 } |
| 2952 | 3089 |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3672 PcDescriptors::kOther, | 3809 PcDescriptors::kOther, |
| 3673 locs()); | 3810 locs()); |
| 3674 __ Drop(2); // Discard type arguments and receiver. | 3811 __ Drop(2); // Discard type arguments and receiver. |
| 3675 } | 3812 } |
| 3676 | 3813 |
| 3677 } // namespace dart | 3814 } // namespace dart |
| 3678 | 3815 |
| 3679 #undef __ | 3816 #undef __ |
| 3680 | 3817 |
| 3681 #endif // defined TARGET_ARCH_X64 | 3818 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |