| 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_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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 LocationSummary* locs = | 895 LocationSummary* locs = |
| 896 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 896 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 897 locs->set_in(0, Location::RequiresRegister()); | 897 locs->set_in(0, Location::RequiresRegister()); |
| 898 // The smi index is either untagged (element size == 1), or it is left smi | 898 // The smi index is either untagged (element size == 1), or it is left smi |
| 899 // tagged (for all element sizes > 1). | 899 // tagged (for all element sizes > 1). |
| 900 // TODO(regis): Revisit and see if the index can be immediate. | 900 // TODO(regis): Revisit and see if the index can be immediate. |
| 901 locs->set_in(1, Location::WritableRegister()); | 901 locs->set_in(1, Location::WritableRegister()); |
| 902 if ((representation() == kUnboxedDouble) || | 902 if ((representation() == kUnboxedDouble) || |
| 903 (representation() == kUnboxedFloat32x4) || | 903 (representation() == kUnboxedFloat32x4) || |
| 904 (representation() == kUnboxedInt32x4)) { | 904 (representation() == kUnboxedInt32x4)) { |
| 905 locs->set_out(Location::RequiresFpuRegister()); | 905 if (class_id() == kTypedDataFloat32ArrayCid) { |
| 906 // Need register <= Q3 for float operations. |
| 907 locs->set_out(Location::FpuRegisterLocation(Q3)); |
| 908 } else { |
| 909 locs->set_out(Location::RequiresFpuRegister()); |
| 910 } |
| 906 } else { | 911 } else { |
| 907 locs->set_out(Location::RequiresRegister()); | 912 locs->set_out(Location::RequiresRegister()); |
| 908 } | 913 } |
| 909 return locs; | 914 return locs; |
| 910 } | 915 } |
| 911 | 916 |
| 912 | 917 |
| 913 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 918 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 914 Register array = locs()->in(0).reg(); | 919 Register array = locs()->in(0).reg(); |
| 915 Location index = locs()->in(1); | 920 Location index = locs()->in(1); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 DRegister dresult0 = EvenDRegisterOf(result); | 964 DRegister dresult0 = EvenDRegisterOf(result); |
| 960 DRegister dresult1 = OddDRegisterOf(result); | 965 DRegister dresult1 = OddDRegisterOf(result); |
| 961 switch (class_id()) { | 966 switch (class_id()) { |
| 962 case kTypedDataInt32ArrayCid: | 967 case kTypedDataInt32ArrayCid: |
| 963 UNIMPLEMENTED(); | 968 UNIMPLEMENTED(); |
| 964 break; | 969 break; |
| 965 case kTypedDataUint32ArrayCid: | 970 case kTypedDataUint32ArrayCid: |
| 966 UNIMPLEMENTED(); | 971 UNIMPLEMENTED(); |
| 967 break; | 972 break; |
| 968 case kTypedDataFloat32ArrayCid: | 973 case kTypedDataFloat32ArrayCid: |
| 969 // Load single precision float and promote to double. | 974 // Load single precision float. |
| 970 // vldrs does not support indexed addressing. | 975 // vldrs does not support indexed addressing. |
| 971 __ add(index.reg(), index.reg(), ShifterOperand(array)); | 976 __ add(index.reg(), index.reg(), ShifterOperand(array)); |
| 972 element_address = Address(index.reg(), 0); | 977 element_address = Address(index.reg(), 0); |
| 973 __ vldrs(STMP, element_address); | 978 __ vldrs(EvenSRegisterOf(dresult0), element_address); |
| 974 __ vcvtds(dresult0, STMP); | |
| 975 break; | 979 break; |
| 976 case kTypedDataFloat64ArrayCid: | 980 case kTypedDataFloat64ArrayCid: |
| 977 // vldrd does not support indexed addressing. | 981 // vldrd does not support indexed addressing. |
| 978 __ add(index.reg(), index.reg(), ShifterOperand(array)); | 982 __ add(index.reg(), index.reg(), ShifterOperand(array)); |
| 979 element_address = Address(index.reg(), 0); | 983 element_address = Address(index.reg(), 0); |
| 980 __ vldrd(dresult0, element_address); | 984 __ vldrd(dresult0, element_address); |
| 981 break; | 985 break; |
| 982 case kTypedDataInt32x4ArrayCid: | 986 case kTypedDataInt32x4ArrayCid: |
| 983 case kTypedDataFloat32x4ArrayCid: | 987 case kTypedDataFloat32x4ArrayCid: |
| 984 __ add(index.reg(), index.reg(), ShifterOperand(array)); | 988 __ add(index.reg(), index.reg(), ShifterOperand(array)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 case kTypedDataUint8ArrayCid: | 1100 case kTypedDataUint8ArrayCid: |
| 1097 case kTypedDataUint8ClampedArrayCid: | 1101 case kTypedDataUint8ClampedArrayCid: |
| 1098 case kOneByteStringCid: | 1102 case kOneByteStringCid: |
| 1099 case kTypedDataInt16ArrayCid: | 1103 case kTypedDataInt16ArrayCid: |
| 1100 case kTypedDataUint16ArrayCid: | 1104 case kTypedDataUint16ArrayCid: |
| 1101 case kTypedDataInt32ArrayCid: | 1105 case kTypedDataInt32ArrayCid: |
| 1102 case kTypedDataUint32ArrayCid: | 1106 case kTypedDataUint32ArrayCid: |
| 1103 locs->set_in(2, Location::WritableRegister()); | 1107 locs->set_in(2, Location::WritableRegister()); |
| 1104 break; | 1108 break; |
| 1105 case kTypedDataFloat32ArrayCid: | 1109 case kTypedDataFloat32ArrayCid: |
| 1110 // Need low register (<= Q3). |
| 1111 locs->set_in(2, Location::FpuRegisterLocation(Q3)); |
| 1112 break; |
| 1106 case kTypedDataFloat64ArrayCid: // TODO(srdjan): Support Float64 constants. | 1113 case kTypedDataFloat64ArrayCid: // TODO(srdjan): Support Float64 constants. |
| 1107 case kTypedDataInt32x4ArrayCid: | 1114 case kTypedDataInt32x4ArrayCid: |
| 1108 case kTypedDataFloat32x4ArrayCid: | 1115 case kTypedDataFloat32x4ArrayCid: |
| 1109 locs->set_in(2, Location::RequiresFpuRegister()); | 1116 locs->set_in(2, Location::RequiresFpuRegister()); |
| 1110 break; | 1117 break; |
| 1111 default: | 1118 default: |
| 1112 UNREACHABLE(); | 1119 UNREACHABLE(); |
| 1113 return NULL; | 1120 return NULL; |
| 1114 } | 1121 } |
| 1115 return locs; | 1122 return locs; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 ASSERT(RequiredInputRepresentation(2) == kTagged); | 1231 ASSERT(RequiredInputRepresentation(2) == kTagged); |
| 1225 Register value = locs()->in(2).reg(); | 1232 Register value = locs()->in(2).reg(); |
| 1226 __ SmiUntag(value); | 1233 __ SmiUntag(value); |
| 1227 __ str(value, element_address); | 1234 __ str(value, element_address); |
| 1228 } else { | 1235 } else { |
| 1229 UNIMPLEMENTED(); | 1236 UNIMPLEMENTED(); |
| 1230 } | 1237 } |
| 1231 break; | 1238 break; |
| 1232 } | 1239 } |
| 1233 case kTypedDataFloat32ArrayCid: { | 1240 case kTypedDataFloat32ArrayCid: { |
| 1234 DRegister in2 = EvenDRegisterOf(locs()->in(2).fpu_reg()); | 1241 SRegister value = |
| 1235 // Convert to single precision. | 1242 EvenSRegisterOf(EvenDRegisterOf(locs()->in(2).fpu_reg())); |
| 1236 __ vcvtsd(STMP, in2); | |
| 1237 // Store. | |
| 1238 __ add(index.reg(), index.reg(), ShifterOperand(array)); | 1243 __ add(index.reg(), index.reg(), ShifterOperand(array)); |
| 1239 __ StoreSToOffset(STMP, index.reg(), 0); | 1244 __ StoreSToOffset(value, index.reg(), 0); |
| 1240 break; | 1245 break; |
| 1241 } | 1246 } |
| 1242 case kTypedDataFloat64ArrayCid: { | 1247 case kTypedDataFloat64ArrayCid: { |
| 1243 DRegister in2 = EvenDRegisterOf(locs()->in(2).fpu_reg()); | 1248 DRegister in2 = EvenDRegisterOf(locs()->in(2).fpu_reg()); |
| 1244 __ add(index.reg(), index.reg(), ShifterOperand(array)); | 1249 __ add(index.reg(), index.reg(), ShifterOperand(array)); |
| 1245 __ StoreDToOffset(in2, index.reg(), 0); | 1250 __ StoreDToOffset(in2, index.reg(), 0); |
| 1246 break; | 1251 break; |
| 1247 } | 1252 } |
| 1248 case kTypedDataInt32x4ArrayCid: | 1253 case kTypedDataInt32x4ArrayCid: |
| 1249 case kTypedDataFloat32x4ArrayCid: { | 1254 case kTypedDataFloat32x4ArrayCid: { |
| (...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4203 __ vcvtid(STMP, value); | 4208 __ vcvtid(STMP, value); |
| 4204 __ vmovrs(result, STMP); | 4209 __ vmovrs(result, STMP); |
| 4205 // Check for overflow and that it fits into Smi. | 4210 // Check for overflow and that it fits into Smi. |
| 4206 __ CompareImmediate(result, 0xC0000000); | 4211 __ CompareImmediate(result, 0xC0000000); |
| 4207 __ b(deopt, MI); | 4212 __ b(deopt, MI); |
| 4208 __ SmiTag(result); | 4213 __ SmiTag(result); |
| 4209 } | 4214 } |
| 4210 | 4215 |
| 4211 | 4216 |
| 4212 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(bool opt) const { | 4217 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(bool opt) const { |
| 4218 UNIMPLEMENTED(); |
| 4219 return NULL; |
| 4220 } |
| 4221 |
| 4222 |
| 4223 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4224 UNIMPLEMENTED(); |
| 4225 } |
| 4226 |
| 4227 |
| 4228 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(bool opt) const { |
| 4213 const intptr_t kNumInputs = 1; | 4229 const intptr_t kNumInputs = 1; |
| 4214 const intptr_t kNumTemps = 0; | 4230 const intptr_t kNumTemps = 0; |
| 4215 LocationSummary* result = | 4231 LocationSummary* result = |
| 4216 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4232 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4217 result->set_in(0, Location::RequiresFpuRegister()); | 4233 // Low (<= Q3) Q registers are needed for the conversion instructions. |
| 4218 result->set_out(Location::RequiresFpuRegister()); | 4234 result->set_in(0, Location::FpuRegisterLocation(Q3)); |
| 4235 result->set_out(Location::SameAsFirstInput()); |
| 4219 return result; | 4236 return result; |
| 4220 } | 4237 } |
| 4221 | 4238 |
| 4222 | 4239 |
| 4223 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4240 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4224 // QRegister value = locs()->in(0).fpu_reg(); | 4241 DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 4225 // QRegister result = locs()->out().fpu_reg(); | 4242 SRegister result = EvenSRegisterOf(EvenDRegisterOf(locs()->out().fpu_reg())); |
| 4226 switch (recognized_kind()) { | 4243 __ vcvtsd(result, value); |
| 4227 case MethodRecognizer::kDoubleTruncate: | 4244 } |
| 4228 UNIMPLEMENTED(); | 4245 |
| 4229 // __ roundsd(result, value, Assembler::kRoundToZero); | 4246 |
| 4230 break; | 4247 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(bool opt) const { |
| 4231 case MethodRecognizer::kDoubleFloor: | 4248 const intptr_t kNumInputs = 1; |
| 4232 UNIMPLEMENTED(); | 4249 const intptr_t kNumTemps = 0; |
| 4233 // __ roundsd(result, value, Assembler::kRoundDown); | 4250 LocationSummary* result = |
| 4234 break; | 4251 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4235 case MethodRecognizer::kDoubleCeil: | 4252 // Low (<= Q3) Q registers are needed for the conversion instructions. |
| 4236 UNIMPLEMENTED(); | 4253 result->set_in(0, Location::FpuRegisterLocation(Q3)); |
| 4237 // __ roundsd(result, value, Assembler::kRoundUp); | 4254 result->set_out(Location::SameAsFirstInput()); |
| 4238 break; | 4255 return result; |
| 4239 default: | 4256 } |
| 4240 UNREACHABLE(); | 4257 |
| 4241 } | 4258 |
| 4259 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4260 SRegister value = EvenSRegisterOf(EvenDRegisterOf(locs()->in(0).fpu_reg())); |
| 4261 DRegister result = EvenDRegisterOf(locs()->out().fpu_reg()); |
| 4262 __ vcvtds(result, value); |
| 4242 } | 4263 } |
| 4243 | 4264 |
| 4244 | 4265 |
| 4245 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { | 4266 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { |
| 4246 ASSERT((InputCount() == 1) || (InputCount() == 2)); | 4267 ASSERT((InputCount() == 1) || (InputCount() == 2)); |
| 4247 const intptr_t kNumTemps = 0; | 4268 const intptr_t kNumTemps = 0; |
| 4248 LocationSummary* result = | 4269 LocationSummary* result = |
| 4249 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); | 4270 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); |
| 4250 result->set_in(0, Location::FpuRegisterLocation(Q0)); | 4271 result->set_in(0, Location::FpuRegisterLocation(Q0)); |
| 4251 if (InputCount() == 2) { | 4272 if (InputCount() == 2) { |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4896 compiler->GenerateCall(token_pos(), | 4917 compiler->GenerateCall(token_pos(), |
| 4897 &label, | 4918 &label, |
| 4898 PcDescriptors::kOther, | 4919 PcDescriptors::kOther, |
| 4899 locs()); | 4920 locs()); |
| 4900 __ Drop(2); // Discard type arguments and receiver. | 4921 __ Drop(2); // Discard type arguments and receiver. |
| 4901 } | 4922 } |
| 4902 | 4923 |
| 4903 } // namespace dart | 4924 } // namespace dart |
| 4904 | 4925 |
| 4905 #endif // defined TARGET_ARCH_ARM | 4926 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |