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

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

Issue 13936009: Inline Float32x4 constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 case MethodRecognizer::kFloat32x4ShuffleW: 2888 case MethodRecognizer::kFloat32x4ShuffleW:
2889 __ shufps(value, value, Immediate(0xFF)); 2889 __ shufps(value, value, Immediate(0xFF));
2890 __ cvtss2sd(value, value); 2890 __ cvtss2sd(value, value);
2891 break; 2891 break;
2892 2892
2893 default: UNREACHABLE(); 2893 default: UNREACHABLE();
2894 } 2894 }
2895 } 2895 }
2896 2896
2897 2897
2898 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary() const {
2899 const intptr_t kNumInputs = 4;
2900 const intptr_t kNumTemps = 0;
2901 LocationSummary* summary =
2902 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2903 summary->set_in(0, Location::RequiresFpuRegister());
2904 summary->set_in(1, Location::RequiresFpuRegister());
2905 summary->set_in(2, Location::RequiresFpuRegister());
2906 summary->set_in(3, Location::RequiresFpuRegister());
2907 summary->set_out(Location::SameAsFirstInput());
2908 return summary;
2909 }
2910
2911
2912 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2913 XmmRegister v0 = locs()->in(0).fpu_reg();
2914 XmmRegister v1 = locs()->in(1).fpu_reg();
2915 XmmRegister v2 = locs()->in(2).fpu_reg();
2916 XmmRegister v3 = locs()->in(3).fpu_reg();
2917 ASSERT(v0 == locs()->out().fpu_reg());
2918 switch (op_kind()) {
2919 case MethodRecognizer::kFloat32x4Constructor:
2920 __ subl(ESP, Immediate(16));
2921 __ cvtsd2ss(v0, v0);
2922 __ movss(Address(ESP, -16), v0);
2923 __ movsd(v0, v1);
2924 __ cvtsd2ss(v0, v0);
2925 __ movss(Address(ESP, -12), v0);
2926 __ movsd(v0, v2);
2927 __ cvtsd2ss(v0, v0);
2928 __ movss(Address(ESP, -8), v0);
2929 __ movsd(v0, v3);
2930 __ cvtsd2ss(v0, v0);
2931 __ movss(Address(ESP, -4), v0);
2932 __ movups(v0, Address(ESP, -16));
2933 __ addl(ESP, Immediate(16));
2934 break;
2935 default: UNREACHABLE();
2936 }
2937 }
2938
2939
2940 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary() const {
2941 const intptr_t kNumInputs = 0;
2942 const intptr_t kNumTemps = 0;
2943 LocationSummary* summary =
2944 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2945 summary->set_out(Location::RequiresFpuRegister());
2946 return summary;
2947 }
2948
2949
2950 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2951 XmmRegister value = locs()->out().fpu_reg();
2952 switch (op_kind()) {
2953 case MethodRecognizer::kFloat32x4Zero:
2954 __ xorps(value, value);
2955 break;
2956 default: UNREACHABLE();
2957 }
2958 }
2959
2960
2961 LocationSummary* Float32x4SplatInstr::MakeLocationSummary() const {
2962 const intptr_t kNumInputs = 1;
2963 const intptr_t kNumTemps = 0;
2964 LocationSummary* summary =
2965 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2966 summary->set_in(0, Location::RequiresFpuRegister());
2967 summary->set_out(Location::SameAsFirstInput());
2968 return summary;
2969 }
2970
2971
2972 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2973 XmmRegister value = locs()->out().fpu_reg();
2974 switch (op_kind()) {
2975 case MethodRecognizer::kFloat32x4Splat:
2976 // Convert to Float32.
2977 __ cvtsd2ss(value, value);
2978 // Splat across all lanes.
2979 __ shufps(value, value, Immediate(0x00));
2980 break;
2981 default: UNREACHABLE();
2982 }
2983 }
2984
2985
2898 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { 2986 LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
2899 const intptr_t kNumInputs = 1; 2987 const intptr_t kNumInputs = 1;
2900 const intptr_t kNumTemps = 0; 2988 const intptr_t kNumTemps = 0;
2901 LocationSummary* summary = 2989 LocationSummary* summary =
2902 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2990 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2903 summary->set_in(0, Location::RequiresFpuRegister()); 2991 summary->set_in(0, Location::RequiresFpuRegister());
2904 summary->set_out(Location::RequiresFpuRegister()); 2992 summary->set_out(Location::RequiresFpuRegister());
2905 return summary; 2993 return summary;
2906 } 2994 }
2907 2995
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
4023 PcDescriptors::kOther, 4111 PcDescriptors::kOther,
4024 locs()); 4112 locs());
4025 __ Drop(2); // Discard type arguments and receiver. 4113 __ Drop(2); // Discard type arguments and receiver.
4026 } 4114 }
4027 4115
4028 } // namespace dart 4116 } // namespace dart
4029 4117
4030 #undef __ 4118 #undef __
4031 4119
4032 #endif // defined TARGET_ARCH_IA32 4120 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698