Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Side by Side Diff: runtime/vm/intermediate_language_x64.cc

Issue 13936009: Inline Float32x4 constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after
2903 break; 2903 break;
2904 case MethodRecognizer::kFloat32x4ShuffleW: 2904 case MethodRecognizer::kFloat32x4ShuffleW:
2905 __ shufps(value, value, Immediate(0xFF)); 2905 __ shufps(value, value, Immediate(0xFF));
2906 __ cvtss2sd(value, value); 2906 __ cvtss2sd(value, value);
2907 break; 2907 break;
2908 default: UNREACHABLE(); 2908 default: UNREACHABLE();
2909 } 2909 }
2910 } 2910 }
2911 2911
2912 2912
2913 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary() const {
2914 const intptr_t kNumInputs = 4;
2915 const intptr_t kNumTemps = 0;
2916 LocationSummary* summary =
2917 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2918 summary->set_in(0, Location::RequiresFpuRegister());
2919 summary->set_in(1, Location::RequiresFpuRegister());
2920 summary->set_in(2, Location::RequiresFpuRegister());
2921 summary->set_in(3, Location::RequiresFpuRegister());
2922 summary->set_out(Location::SameAsFirstInput());
2923 return summary;
2924 }
2925
2926
2927 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2928 XmmRegister v0 = locs()->in(0).fpu_reg();
2929 XmmRegister v1 = locs()->in(1).fpu_reg();
2930 XmmRegister v2 = locs()->in(2).fpu_reg();
2931 XmmRegister v3 = locs()->in(3).fpu_reg();
2932 ASSERT(v0 == locs()->out().fpu_reg());
2933 switch (op_kind()) {
2934 case MethodRecognizer::kFloat32x4Constructor:
2935 __ subq(RSP, Immediate(16));
2936 __ cvtsd2ss(v0, v0);
2937 __ movss(Address(RSP, -16), v0);
2938 __ movsd(v0, v1);
2939 __ cvtsd2ss(v0, v0);
2940 __ movss(Address(RSP, -12), v0);
2941 __ movsd(v0, v2);
2942 __ cvtsd2ss(v0, v0);
2943 __ movss(Address(RSP, -8), v0);
2944 __ movsd(v0, v3);
2945 __ cvtsd2ss(v0, v0);
2946 __ movss(Address(RSP, -4), v0);
2947 __ movups(v0, Address(RSP, -16));
2948 __ addq(RSP, Immediate(16));
2949 break;
2950 default: UNREACHABLE();
2951 }
2952 }
2953
2954
2955 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary() const {
2956 const intptr_t kNumInputs = 0;
2957 const intptr_t kNumTemps = 0;
2958 LocationSummary* summary =
2959 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2960 summary->set_out(Location::RequiresFpuRegister());
2961 return summary;
2962 }
2963
2964
2965 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2966 XmmRegister value = locs()->out().fpu_reg();
2967 switch (op_kind()) {
2968 case MethodRecognizer::kFloat32x4Zero:
2969 __ xorps(value, value);
2970 break;
2971 default: UNREACHABLE();
2972 }
2973 }
2974
2975
2976 LocationSummary* Float32x4SplatInstr::MakeLocationSummary() const {
2977 const intptr_t kNumInputs = 1;
2978 const intptr_t kNumTemps = 0;
2979 LocationSummary* summary =
2980 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2981 summary->set_in(0, Location::RequiresFpuRegister());
2982 summary->set_out(Location::SameAsFirstInput());
2983 return summary;
2984 }
2985
2986
2987 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2988 XmmRegister value = locs()->out().fpu_reg();
2989 switch (op_kind()) {
2990 case MethodRecognizer::kFloat32x4Splat:
2991 // Convert to Float32.
2992 __ cvtsd2ss(value, value);
2993 // Splat across all lanes.
2994 __ shufps(value, value, Immediate(0x00));
2995 break;
2996 default: UNREACHABLE();
2997 }
2998 }
2999
3000
2913 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { 3001 LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
2914 const intptr_t kNumInputs = 1; 3002 const intptr_t kNumInputs = 1;
2915 const intptr_t kNumTemps = 0; 3003 const intptr_t kNumTemps = 0;
2916 LocationSummary* summary = 3004 LocationSummary* summary =
2917 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3005 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2918 summary->set_in(0, Location::RequiresFpuRegister()); 3006 summary->set_in(0, Location::RequiresFpuRegister());
2919 summary->set_out(Location::RequiresFpuRegister()); 3007 summary->set_out(Location::RequiresFpuRegister());
2920 return summary; 3008 return summary;
2921 } 3009 }
2922 3010
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
3659 PcDescriptors::kOther, 3747 PcDescriptors::kOther,
3660 locs()); 3748 locs());
3661 __ Drop(2); // Discard type arguments and receiver. 3749 __ Drop(2); // Discard type arguments and receiver.
3662 } 3750 }
3663 3751
3664 } // namespace dart 3752 } // namespace dart
3665 3753
3666 #undef __ 3754 #undef __
3667 3755
3668 #endif // defined TARGET_ARCH_X64 3756 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698