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

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

Issue 172293004: Explicit conversions for Float32 array loads/stores. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed ARM register constraints Created 6 years, 10 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
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 switch (class_id()) { 953 switch (class_id()) {
954 case kTypedDataInt32ArrayCid: 954 case kTypedDataInt32ArrayCid:
955 __ movss(result, element_address); 955 __ movss(result, element_address);
956 __ pmovsxdq(result, result); 956 __ pmovsxdq(result, result);
957 break; 957 break;
958 case kTypedDataUint32ArrayCid: 958 case kTypedDataUint32ArrayCid:
959 __ xorpd(result, result); 959 __ xorpd(result, result);
960 __ movss(result, element_address); 960 __ movss(result, element_address);
961 break; 961 break;
962 case kTypedDataFloat32ArrayCid: 962 case kTypedDataFloat32ArrayCid:
963 // Load single precision float and promote to double.
964 __ movss(result, element_address); 963 __ movss(result, element_address);
965 __ cvtss2sd(result, locs()->out().fpu_reg());
966 break; 964 break;
967 case kTypedDataFloat64ArrayCid: 965 case kTypedDataFloat64ArrayCid:
968 __ movsd(result, element_address); 966 __ movsd(result, element_address);
969 break; 967 break;
970 case kTypedDataInt32x4ArrayCid: 968 case kTypedDataInt32x4ArrayCid:
971 case kTypedDataFloat32x4ArrayCid: 969 case kTypedDataFloat32x4ArrayCid:
972 __ movups(result, element_address); 970 __ movups(result, element_address);
973 break; 971 break;
974 } 972 }
975 return; 973 return;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 break; 1100 break;
1103 case kTypedDataInt32ArrayCid: 1101 case kTypedDataInt32ArrayCid:
1104 case kTypedDataUint32ArrayCid: 1102 case kTypedDataUint32ArrayCid:
1105 // Mints are stored in XMM registers. For smis, use a writable register 1103 // Mints are stored in XMM registers. For smis, use a writable register
1106 // because the value must be untagged before storing. 1104 // because the value must be untagged before storing.
1107 locs->set_in(2, value()->IsSmiValue() 1105 locs->set_in(2, value()->IsSmiValue()
1108 ? Location::WritableRegister() 1106 ? Location::WritableRegister()
1109 : Location::RequiresFpuRegister()); 1107 : Location::RequiresFpuRegister());
1110 break; 1108 break;
1111 case kTypedDataFloat32ArrayCid: 1109 case kTypedDataFloat32ArrayCid:
1112 // Need temp register for float-to-double conversion.
1113 locs->AddTemp(Location::RequiresFpuRegister());
1114 // Fall through.
1115 case kTypedDataFloat64ArrayCid: 1110 case kTypedDataFloat64ArrayCid:
1116 // TODO(srdjan): Support Float64 constants. 1111 // TODO(srdjan): Support Float64 constants.
1117 locs->set_in(2, Location::RequiresFpuRegister()); 1112 locs->set_in(2, Location::RequiresFpuRegister());
1118 break; 1113 break;
1119 case kTypedDataInt32x4ArrayCid: 1114 case kTypedDataInt32x4ArrayCid:
1120 case kTypedDataFloat32x4ArrayCid: 1115 case kTypedDataFloat32x4ArrayCid:
1121 locs->set_in(2, Location::RequiresFpuRegister()); 1116 locs->set_in(2, Location::RequiresFpuRegister());
1122 break; 1117 break;
1123 default: 1118 default:
1124 UNREACHABLE(); 1119 UNREACHABLE();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 ASSERT(RequiredInputRepresentation(2) == kTagged); 1217 ASSERT(RequiredInputRepresentation(2) == kTagged);
1223 Register value = locs()->in(2).reg(); 1218 Register value = locs()->in(2).reg();
1224 __ SmiUntag(value); 1219 __ SmiUntag(value);
1225 __ movl(element_address, value); 1220 __ movl(element_address, value);
1226 } else { 1221 } else {
1227 ASSERT(RequiredInputRepresentation(2) == kUnboxedMint); 1222 ASSERT(RequiredInputRepresentation(2) == kUnboxedMint);
1228 __ movss(element_address, locs()->in(2).fpu_reg()); 1223 __ movss(element_address, locs()->in(2).fpu_reg());
1229 } 1224 }
1230 break; 1225 break;
1231 case kTypedDataFloat32ArrayCid: 1226 case kTypedDataFloat32ArrayCid:
1232 // Convert to single precision. 1227 __ movss(element_address, locs()->in(2).fpu_reg());
1233 __ cvtsd2ss(locs()->temp(0).fpu_reg(), locs()->in(2).fpu_reg());
1234 // Store.
1235 __ movss(element_address, locs()->temp(0).fpu_reg());
1236 break; 1228 break;
1237 case kTypedDataFloat64ArrayCid: 1229 case kTypedDataFloat64ArrayCid:
1238 __ movsd(element_address, locs()->in(2).fpu_reg()); 1230 __ movsd(element_address, locs()->in(2).fpu_reg());
1239 break; 1231 break;
1240 case kTypedDataInt32x4ArrayCid: 1232 case kTypedDataInt32x4ArrayCid:
1241 case kTypedDataFloat32x4ArrayCid: 1233 case kTypedDataFloat32x4ArrayCid:
1242 __ movups(element_address, locs()->in(2).fpu_reg()); 1234 __ movups(element_address, locs()->in(2).fpu_reg());
1243 break; 1235 break;
1244 default: 1236 default:
1245 UNREACHABLE(); 1237 UNREACHABLE();
(...skipping 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after
4159 break; 4151 break;
4160 case MethodRecognizer::kDoubleCeil: 4152 case MethodRecognizer::kDoubleCeil:
4161 __ roundsd(result, value, Assembler::kRoundUp); 4153 __ roundsd(result, value, Assembler::kRoundUp);
4162 break; 4154 break;
4163 default: 4155 default:
4164 UNREACHABLE(); 4156 UNREACHABLE();
4165 } 4157 }
4166 } 4158 }
4167 4159
4168 4160
4161 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(bool opt) const {
4162 const intptr_t kNumInputs = 1;
4163 const intptr_t kNumTemps = 0;
4164 LocationSummary* result =
4165 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
4166 result->set_in(0, Location::RequiresFpuRegister());
4167 result->set_out(Location::SameAsFirstInput());
4168 return result;
4169 }
4170
4171
4172 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4173 __ cvtsd2ss(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
4174 }
4175
4176
4177 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(bool opt) const {
4178 const intptr_t kNumInputs = 1;
4179 const intptr_t kNumTemps = 0;
4180 LocationSummary* result =
4181 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
4182 result->set_in(0, Location::RequiresFpuRegister());
4183 result->set_out(Location::SameAsFirstInput());
4184 return result;
4185 }
4186
4187
4188 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4189 __ cvtss2sd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
4190 }
4191
4192
4169 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { 4193 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const {
4170 ASSERT((InputCount() == 1) || (InputCount() == 2)); 4194 ASSERT((InputCount() == 1) || (InputCount() == 2));
4171 const intptr_t kNumTemps = 0; 4195 const intptr_t kNumTemps = 0;
4172 LocationSummary* result = 4196 LocationSummary* result =
4173 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); 4197 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall);
4174 result->set_in(0, Location::FpuRegisterLocation(XMM1)); 4198 result->set_in(0, Location::FpuRegisterLocation(XMM1));
4175 if (InputCount() == 2) { 4199 if (InputCount() == 2) {
4176 result->set_in(1, Location::FpuRegisterLocation(XMM2)); 4200 result->set_in(1, Location::FpuRegisterLocation(XMM2));
4177 } 4201 }
4178 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { 4202 if (recognized_kind() == MethodRecognizer::kMathDoublePow) {
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
5275 PcDescriptors::kOther, 5299 PcDescriptors::kOther,
5276 locs()); 5300 locs());
5277 __ Drop(2); // Discard type arguments and receiver. 5301 __ Drop(2); // Discard type arguments and receiver.
5278 } 5302 }
5279 5303
5280 } // namespace dart 5304 } // namespace dart
5281 5305
5282 #undef __ 5306 #undef __
5283 5307
5284 #endif // defined TARGET_ARCH_IA32 5308 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698