| 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_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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 (representation() == kUnboxedFloat32x4) || | 878 (representation() == kUnboxedFloat32x4) || |
| 879 (representation() == kUnboxedInt32x4)) { | 879 (representation() == kUnboxedInt32x4)) { |
| 880 if ((index_scale() == 1) && index.IsRegister()) { | 880 if ((index_scale() == 1) && index.IsRegister()) { |
| 881 __ SmiUntag(index.reg()); | 881 __ SmiUntag(index.reg()); |
| 882 } | 882 } |
| 883 | 883 |
| 884 XmmRegister result = locs()->out().fpu_reg(); | 884 XmmRegister result = locs()->out().fpu_reg(); |
| 885 if (class_id() == kTypedDataFloat32ArrayCid) { | 885 if (class_id() == kTypedDataFloat32ArrayCid) { |
| 886 // Load single precision float. | 886 // Load single precision float. |
| 887 __ movss(result, element_address); | 887 __ movss(result, element_address); |
| 888 // Promote to double. | |
| 889 __ cvtss2sd(result, locs()->out().fpu_reg()); | |
| 890 } else if (class_id() == kTypedDataFloat64ArrayCid) { | 888 } else if (class_id() == kTypedDataFloat64ArrayCid) { |
| 891 __ movsd(result, element_address); | 889 __ movsd(result, element_address); |
| 892 } else { | 890 } else { |
| 893 ASSERT((class_id() == kTypedDataInt32x4ArrayCid) || | 891 ASSERT((class_id() == kTypedDataInt32x4ArrayCid) || |
| 894 (class_id() == kTypedDataFloat32x4ArrayCid)); | 892 (class_id() == kTypedDataFloat32x4ArrayCid)); |
| 895 __ movups(result, element_address); | 893 __ movups(result, element_address); |
| 896 } | 894 } |
| 897 return; | 895 return; |
| 898 } | 896 } |
| 899 | 897 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 locs->set_in(2, Location::FixedRegisterOrSmiConstant(value(), RAX)); | 1005 locs->set_in(2, Location::FixedRegisterOrSmiConstant(value(), RAX)); |
| 1008 break; | 1006 break; |
| 1009 case kTypedDataInt16ArrayCid: | 1007 case kTypedDataInt16ArrayCid: |
| 1010 case kTypedDataUint16ArrayCid: | 1008 case kTypedDataUint16ArrayCid: |
| 1011 case kTypedDataInt32ArrayCid: | 1009 case kTypedDataInt32ArrayCid: |
| 1012 case kTypedDataUint32ArrayCid: | 1010 case kTypedDataUint32ArrayCid: |
| 1013 // Writable register because the value must be untagged before storing. | 1011 // Writable register because the value must be untagged before storing. |
| 1014 locs->set_in(2, Location::WritableRegister()); | 1012 locs->set_in(2, Location::WritableRegister()); |
| 1015 break; | 1013 break; |
| 1016 case kTypedDataFloat32ArrayCid: | 1014 case kTypedDataFloat32ArrayCid: |
| 1017 // Need temp register for float-to-double conversion. | |
| 1018 locs->AddTemp(Location::RequiresFpuRegister()); | |
| 1019 // Fall through. | |
| 1020 case kTypedDataFloat64ArrayCid: | 1015 case kTypedDataFloat64ArrayCid: |
| 1021 // TODO(srdjan): Support Float64 constants. | 1016 // TODO(srdjan): Support Float64 constants. |
| 1022 locs->set_in(2, Location::RequiresFpuRegister()); | 1017 locs->set_in(2, Location::RequiresFpuRegister()); |
| 1023 break; | 1018 break; |
| 1024 case kTypedDataInt32x4ArrayCid: | 1019 case kTypedDataInt32x4ArrayCid: |
| 1025 case kTypedDataFloat32x4ArrayCid: | 1020 case kTypedDataFloat32x4ArrayCid: |
| 1026 locs->set_in(2, Location::RequiresFpuRegister()); | 1021 locs->set_in(2, Location::RequiresFpuRegister()); |
| 1027 break; | 1022 break; |
| 1028 default: | 1023 default: |
| 1029 UNREACHABLE(); | 1024 UNREACHABLE(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 break; | 1119 break; |
| 1125 } | 1120 } |
| 1126 case kTypedDataInt32ArrayCid: | 1121 case kTypedDataInt32ArrayCid: |
| 1127 case kTypedDataUint32ArrayCid: { | 1122 case kTypedDataUint32ArrayCid: { |
| 1128 Register value = locs()->in(2).reg(); | 1123 Register value = locs()->in(2).reg(); |
| 1129 __ SmiUntag(value); | 1124 __ SmiUntag(value); |
| 1130 __ movl(element_address, value); | 1125 __ movl(element_address, value); |
| 1131 break; | 1126 break; |
| 1132 } | 1127 } |
| 1133 case kTypedDataFloat32ArrayCid: | 1128 case kTypedDataFloat32ArrayCid: |
| 1134 // Convert to single precision. | 1129 __ movss(element_address, locs()->in(2).fpu_reg()); |
| 1135 __ cvtsd2ss(locs()->temp(0).fpu_reg(), locs()->in(2).fpu_reg()); | |
| 1136 // Store. | |
| 1137 __ movss(element_address, locs()->temp(0).fpu_reg()); | |
| 1138 break; | 1130 break; |
| 1139 case kTypedDataFloat64ArrayCid: | 1131 case kTypedDataFloat64ArrayCid: |
| 1140 __ movsd(element_address, locs()->in(2).fpu_reg()); | 1132 __ movsd(element_address, locs()->in(2).fpu_reg()); |
| 1141 break; | 1133 break; |
| 1142 case kTypedDataInt32x4ArrayCid: | 1134 case kTypedDataInt32x4ArrayCid: |
| 1143 case kTypedDataFloat32x4ArrayCid: | 1135 case kTypedDataFloat32x4ArrayCid: |
| 1144 __ movups(element_address, locs()->in(2).fpu_reg()); | 1136 __ movups(element_address, locs()->in(2).fpu_reg()); |
| 1145 break; | 1137 break; |
| 1146 default: | 1138 default: |
| 1147 UNREACHABLE(); | 1139 UNREACHABLE(); |
| (...skipping 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4182 break; | 4174 break; |
| 4183 case MethodRecognizer::kDoubleCeil: | 4175 case MethodRecognizer::kDoubleCeil: |
| 4184 __ roundsd(result, value, Assembler::kRoundUp); | 4176 __ roundsd(result, value, Assembler::kRoundUp); |
| 4185 break; | 4177 break; |
| 4186 default: | 4178 default: |
| 4187 UNREACHABLE(); | 4179 UNREACHABLE(); |
| 4188 } | 4180 } |
| 4189 } | 4181 } |
| 4190 | 4182 |
| 4191 | 4183 |
| 4184 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(bool opt) const { |
| 4185 const intptr_t kNumInputs = 1; |
| 4186 const intptr_t kNumTemps = 0; |
| 4187 LocationSummary* result = |
| 4188 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4189 result->set_in(0, Location::RequiresFpuRegister()); |
| 4190 result->set_out(Location::SameAsFirstInput()); |
| 4191 return result; |
| 4192 } |
| 4193 |
| 4194 |
| 4195 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4196 __ cvtsd2ss(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); |
| 4197 } |
| 4198 |
| 4199 |
| 4200 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(bool opt) const { |
| 4201 const intptr_t kNumInputs = 1; |
| 4202 const intptr_t kNumTemps = 0; |
| 4203 LocationSummary* result = |
| 4204 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4205 result->set_in(0, Location::RequiresFpuRegister()); |
| 4206 result->set_out(Location::SameAsFirstInput()); |
| 4207 return result; |
| 4208 } |
| 4209 |
| 4210 |
| 4211 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4212 __ cvtss2sd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); |
| 4213 } |
| 4214 |
| 4215 |
| 4192 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { | 4216 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(bool opt) const { |
| 4193 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two | 4217 // Calling convention on x64 uses XMM0 and XMM1 to pass the first two |
| 4194 // double arguments and XMM0 to return the result. Unfortunately | 4218 // double arguments and XMM0 to return the result. Unfortunately |
| 4195 // currently we can't specify these registers because ParallelMoveResolver | 4219 // currently we can't specify these registers because ParallelMoveResolver |
| 4196 // assumes that XMM0 is free at all times. | 4220 // assumes that XMM0 is free at all times. |
| 4197 // TODO(vegorov): allow XMM0 to be used. | 4221 // TODO(vegorov): allow XMM0 to be used. |
| 4198 ASSERT((InputCount() == 1) || (InputCount() == 2)); | 4222 ASSERT((InputCount() == 1) || (InputCount() == 2)); |
| 4199 const intptr_t kNumTemps = 0; | 4223 const intptr_t kNumTemps = 0; |
| 4200 LocationSummary* result = | 4224 LocationSummary* result = |
| 4201 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); | 4225 new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall); |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4990 PcDescriptors::kOther, | 5014 PcDescriptors::kOther, |
| 4991 locs()); | 5015 locs()); |
| 4992 __ Drop(2); // Discard type arguments and receiver. | 5016 __ Drop(2); // Discard type arguments and receiver. |
| 4993 } | 5017 } |
| 4994 | 5018 |
| 4995 } // namespace dart | 5019 } // namespace dart |
| 4996 | 5020 |
| 4997 #undef __ | 5021 #undef __ |
| 4998 | 5022 |
| 4999 #endif // defined TARGET_ARCH_X64 | 5023 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |