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

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

Issue 172293004: Explicit conversions for Float32 array loads/stores. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 DRegister dresult0 = EvenDRegisterOf(result); 959 DRegister dresult0 = EvenDRegisterOf(result);
960 DRegister dresult1 = OddDRegisterOf(result); 960 DRegister dresult1 = OddDRegisterOf(result);
961 switch (class_id()) { 961 switch (class_id()) {
962 case kTypedDataInt32ArrayCid: 962 case kTypedDataInt32ArrayCid:
963 UNIMPLEMENTED(); 963 UNIMPLEMENTED();
964 break; 964 break;
965 case kTypedDataUint32ArrayCid: 965 case kTypedDataUint32ArrayCid:
966 UNIMPLEMENTED(); 966 UNIMPLEMENTED();
967 break; 967 break;
968 case kTypedDataFloat32ArrayCid: 968 case kTypedDataFloat32ArrayCid:
969 // Load single precision float and promote to double. 969 // Load single precision float.
970 // vldrs does not support indexed addressing. 970 // vldrs does not support indexed addressing.
971 __ add(index.reg(), index.reg(), ShifterOperand(array)); 971 __ add(index.reg(), index.reg(), ShifterOperand(array));
972 element_address = Address(index.reg(), 0); 972 element_address = Address(index.reg(), 0);
973 __ vldrs(STMP, element_address); 973 __ vldrs(EvenSRegisterOf(dresult0), element_address);
974 __ vcvtds(dresult0, STMP);
975 break; 974 break;
976 case kTypedDataFloat64ArrayCid: 975 case kTypedDataFloat64ArrayCid:
977 // vldrd does not support indexed addressing. 976 // vldrd does not support indexed addressing.
978 __ add(index.reg(), index.reg(), ShifterOperand(array)); 977 __ add(index.reg(), index.reg(), ShifterOperand(array));
979 element_address = Address(index.reg(), 0); 978 element_address = Address(index.reg(), 0);
980 __ vldrd(dresult0, element_address); 979 __ vldrd(dresult0, element_address);
981 break; 980 break;
982 case kTypedDataInt32x4ArrayCid: 981 case kTypedDataInt32x4ArrayCid:
983 case kTypedDataFloat32x4ArrayCid: 982 case kTypedDataFloat32x4ArrayCid:
984 __ add(index.reg(), index.reg(), ShifterOperand(array)); 983 __ add(index.reg(), index.reg(), ShifterOperand(array));
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 ASSERT(RequiredInputRepresentation(2) == kTagged); 1223 ASSERT(RequiredInputRepresentation(2) == kTagged);
1225 Register value = locs()->in(2).reg(); 1224 Register value = locs()->in(2).reg();
1226 __ SmiUntag(value); 1225 __ SmiUntag(value);
1227 __ str(value, element_address); 1226 __ str(value, element_address);
1228 } else { 1227 } else {
1229 UNIMPLEMENTED(); 1228 UNIMPLEMENTED();
1230 } 1229 }
1231 break; 1230 break;
1232 } 1231 }
1233 case kTypedDataFloat32ArrayCid: { 1232 case kTypedDataFloat32ArrayCid: {
1234 DRegister in2 = EvenDRegisterOf(locs()->in(2).fpu_reg()); 1233 SRegister value =
1235 // Convert to single precision. 1234 EvenSRegisterOf(EvenDRegisterOf(locs()->in(2).fpu_reg()));
1236 __ vcvtsd(STMP, in2);
1237 // Store.
1238 __ add(index.reg(), index.reg(), ShifterOperand(array)); 1235 __ add(index.reg(), index.reg(), ShifterOperand(array));
1239 __ StoreSToOffset(STMP, index.reg(), 0); 1236 __ StoreSToOffset(value, index.reg(), 0);
1240 break; 1237 break;
1241 } 1238 }
1242 case kTypedDataFloat64ArrayCid: { 1239 case kTypedDataFloat64ArrayCid: {
1243 DRegister in2 = EvenDRegisterOf(locs()->in(2).fpu_reg()); 1240 DRegister in2 = EvenDRegisterOf(locs()->in(2).fpu_reg());
1244 __ add(index.reg(), index.reg(), ShifterOperand(array)); 1241 __ add(index.reg(), index.reg(), ShifterOperand(array));
1245 __ StoreDToOffset(in2, index.reg(), 0); 1242 __ StoreDToOffset(in2, index.reg(), 0);
1246 break; 1243 break;
1247 } 1244 }
1248 case kTypedDataInt32x4ArrayCid: 1245 case kTypedDataInt32x4ArrayCid:
1249 case kTypedDataFloat32x4ArrayCid: { 1246 case kTypedDataFloat32x4ArrayCid: {
(...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after
4203 __ vcvtid(STMP, value); 4200 __ vcvtid(STMP, value);
4204 __ vmovrs(result, STMP); 4201 __ vmovrs(result, STMP);
4205 // Check for overflow and that it fits into Smi. 4202 // Check for overflow and that it fits into Smi.
4206 __ CompareImmediate(result, 0xC0000000); 4203 __ CompareImmediate(result, 0xC0000000);
4207 __ b(deopt, MI); 4204 __ b(deopt, MI);
4208 __ SmiTag(result); 4205 __ SmiTag(result);
4209 } 4206 }
4210 4207
4211 4208
4212 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(bool opt) const { 4209 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(bool opt) const {
4210 UNIMPLEMENTED();
4211 return NULL;
4212 }
4213
4214
4215 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4216 UNIMPLEMENTED();
4217 }
4218
4219
4220 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(bool opt) const {
4213 const intptr_t kNumInputs = 1; 4221 const intptr_t kNumInputs = 1;
4214 const intptr_t kNumTemps = 0; 4222 const intptr_t kNumTemps = 0;
4215 LocationSummary* result = 4223 LocationSummary* result =
4216 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 4224 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
4217 result->set_in(0, Location::RequiresFpuRegister()); 4225 result->set_in(0, Location::RequiresFpuRegister());
4218 result->set_out(Location::RequiresFpuRegister()); 4226 result->set_out(Location::SameAsFirstInput());
4219 return result; 4227 return result;
4220 } 4228 }
4221 4229
4222 4230
4223 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4231 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4224 // QRegister value = locs()->in(0).fpu_reg(); 4232 DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg());
4225 // QRegister result = locs()->out().fpu_reg(); 4233 SRegister result = EvenSRegisterOf(EvenDRegisterOf(locs()->out().fpu_reg()));
4226 switch (recognized_kind()) { 4234 __ vcvtsd(result, value);
4227 case MethodRecognizer::kDoubleTruncate: 4235 }
4228 UNIMPLEMENTED(); 4236
4229 // __ roundsd(result, value, Assembler::kRoundToZero); 4237
4230 break; 4238 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(bool opt) const {
4231 case MethodRecognizer::kDoubleFloor: 4239 const intptr_t kNumInputs = 1;
4232 UNIMPLEMENTED(); 4240 const intptr_t kNumTemps = 0;
4233 // __ roundsd(result, value, Assembler::kRoundDown); 4241 LocationSummary* result =
4234 break; 4242 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
4235 case MethodRecognizer::kDoubleCeil: 4243 result->set_in(0, Location::RequiresFpuRegister());
4236 UNIMPLEMENTED(); 4244 result->set_out(Location::SameAsFirstInput());
4237 // __ roundsd(result, value, Assembler::kRoundUp); 4245 return result;
4238 break; 4246 }
4239 default: 4247
4240 UNREACHABLE(); 4248
4241 } 4249 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4250 SRegister value = EvenSRegisterOf(EvenDRegisterOf(locs()->in(0).fpu_reg()));
4251 DRegister result = EvenDRegisterOf(locs()->out().fpu_reg());
4252 __ vcvtds(result, value);
4242 } 4253 }
4243 4254
4244 4255
4245 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { 4256 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const {
4246 ASSERT((InputCount() == 1) || (InputCount() == 2)); 4257 ASSERT((InputCount() == 1) || (InputCount() == 2));
4247 const intptr_t kNumTemps = 0; 4258 const intptr_t kNumTemps = 0;
4248 LocationSummary* result = 4259 LocationSummary* result =
4249 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); 4260 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall);
4250 result->set_in(0, Location::FpuRegisterLocation(Q0)); 4261 result->set_in(0, Location::FpuRegisterLocation(Q0));
4251 if (InputCount() == 2) { 4262 if (InputCount() == 2) {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
4896 compiler->GenerateCall(token_pos(), 4907 compiler->GenerateCall(token_pos(),
4897 &label, 4908 &label,
4898 PcDescriptors::kOther, 4909 PcDescriptors::kOther,
4899 locs()); 4910 locs());
4900 __ Drop(2); // Discard type arguments and receiver. 4911 __ Drop(2); // Discard type arguments and receiver.
4901 } 4912 }
4902 4913
4903 } // namespace dart 4914 } // namespace dart
4904 4915
4905 #endif // defined TARGET_ARCH_ARM 4916 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698