| 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_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 3148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3159 __ reciprocalps(left); | 3159 __ reciprocalps(left); |
| 3160 break; | 3160 break; |
| 3161 case MethodRecognizer::kFloat32x4ReciprocalSqrt: | 3161 case MethodRecognizer::kFloat32x4ReciprocalSqrt: |
| 3162 __ rsqrtps(left); | 3162 __ rsqrtps(left); |
| 3163 break; | 3163 break; |
| 3164 default: UNREACHABLE(); | 3164 default: UNREACHABLE(); |
| 3165 } | 3165 } |
| 3166 } | 3166 } |
| 3167 | 3167 |
| 3168 | 3168 |
| 3169 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary() const { |
| 3170 const intptr_t kNumInputs = 1; |
| 3171 const intptr_t kNumTemps = 0; |
| 3172 LocationSummary* summary = |
| 3173 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3174 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3175 summary->set_out(Location::SameAsFirstInput()); |
| 3176 return summary; |
| 3177 } |
| 3178 |
| 3179 |
| 3180 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3181 XmmRegister left = locs()->in(0).fpu_reg(); |
| 3182 |
| 3183 ASSERT(locs()->out().fpu_reg() == left); |
| 3184 switch (op_kind()) { |
| 3185 case MethodRecognizer::kFloat32x4Negate: |
| 3186 __ negateps(left); |
| 3187 break; |
| 3188 case MethodRecognizer::kFloat32x4Absolute: |
| 3189 __ absps(left); |
| 3190 break; |
| 3191 default: UNREACHABLE(); |
| 3192 } |
| 3193 } |
| 3194 |
| 3195 |
| 3196 LocationSummary* Float32x4ClampInstr::MakeLocationSummary() const { |
| 3197 const intptr_t kNumInputs = 3; |
| 3198 const intptr_t kNumTemps = 0; |
| 3199 LocationSummary* summary = |
| 3200 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3201 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3202 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3203 summary->set_in(2, Location::RequiresFpuRegister()); |
| 3204 summary->set_out(Location::SameAsFirstInput()); |
| 3205 return summary; |
| 3206 } |
| 3207 |
| 3208 |
| 3209 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3210 XmmRegister left = locs()->in(0).fpu_reg(); |
| 3211 XmmRegister lower = locs()->in(1).fpu_reg(); |
| 3212 XmmRegister upper = locs()->in(2).fpu_reg(); |
| 3213 ASSERT(locs()->out().fpu_reg() == left); |
| 3214 __ minps(left, upper); |
| 3215 __ maxps(left, lower); |
| 3216 } |
| 3217 |
| 3218 |
| 3219 LocationSummary* Float32x4WithInstr::MakeLocationSummary() const { |
| 3220 const intptr_t kNumInputs = 2; |
| 3221 const intptr_t kNumTemps = 0; |
| 3222 LocationSummary* summary = |
| 3223 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3224 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3225 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3226 summary->set_out(Location::SameAsFirstInput()); |
| 3227 return summary; |
| 3228 } |
| 3229 |
| 3230 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3231 XmmRegister replacement = locs()->in(0).fpu_reg(); |
| 3232 XmmRegister value = locs()->in(1).fpu_reg(); |
| 3233 |
| 3234 ASSERT(locs()->out().fpu_reg() == replacement); |
| 3235 |
| 3236 switch (op_kind()) { |
| 3237 case MethodRecognizer::kFloat32x4WithX: |
| 3238 __ cvtsd2ss(replacement, replacement); |
| 3239 __ subl(ESP, Immediate(16)); |
| 3240 // Move value to stack. |
| 3241 __ movups(Address(ESP, -16), value); |
| 3242 // Write over X value. |
| 3243 __ movss(Address(ESP, -16), replacement); |
| 3244 // Move updated value into output register. |
| 3245 __ movups(replacement, Address(ESP, -16)); |
| 3246 __ addl(ESP, Immediate(16)); |
| 3247 break; |
| 3248 case MethodRecognizer::kFloat32x4WithY: |
| 3249 __ cvtsd2ss(replacement, replacement); |
| 3250 __ subl(ESP, Immediate(16)); |
| 3251 // Move value to stack. |
| 3252 __ movups(Address(ESP, -16), value); |
| 3253 // Write over Y value. |
| 3254 __ movss(Address(ESP, -12), replacement); |
| 3255 // Move updated value into output register. |
| 3256 __ movups(replacement, Address(ESP, -16)); |
| 3257 __ addl(ESP, Immediate(16)); |
| 3258 break; |
| 3259 case MethodRecognizer::kFloat32x4WithZ: |
| 3260 __ cvtsd2ss(replacement, replacement); |
| 3261 __ subl(ESP, Immediate(16)); |
| 3262 // Move value to stack. |
| 3263 __ movups(Address(ESP, -16), value); |
| 3264 // Write over Z value. |
| 3265 __ movss(Address(ESP, -8), replacement); |
| 3266 // Move updated value into output register. |
| 3267 __ movups(replacement, Address(ESP, -16)); |
| 3268 __ addl(ESP, Immediate(16)); |
| 3269 break; |
| 3270 case MethodRecognizer::kFloat32x4WithW: |
| 3271 __ cvtsd2ss(replacement, replacement); |
| 3272 __ subl(ESP, Immediate(16)); |
| 3273 // Move value to stack. |
| 3274 __ movups(Address(ESP, -16), value); |
| 3275 // Write over W value. |
| 3276 __ movss(Address(ESP, -4), replacement); |
| 3277 // Move updated value into output register. |
| 3278 __ movups(replacement, Address(ESP, -16)); |
| 3279 __ addl(ESP, Immediate(16)); |
| 3280 break; |
| 3281 default: UNREACHABLE(); |
| 3282 } |
| 3283 } |
| 3284 |
| 3285 |
| 3286 LocationSummary* Float32x4ToUint32x4Instr::MakeLocationSummary() const { |
| 3287 const intptr_t kNumInputs = 1; |
| 3288 const intptr_t kNumTemps = 0; |
| 3289 LocationSummary* summary = |
| 3290 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3291 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3292 summary->set_out(Location::SameAsFirstInput()); |
| 3293 return summary; |
| 3294 } |
| 3295 |
| 3296 |
| 3297 void Float32x4ToUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3298 // NOP. |
| 3299 } |
| 3300 |
| 3301 |
| 3169 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { | 3302 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { |
| 3170 const intptr_t kNumInputs = 1; | 3303 const intptr_t kNumInputs = 1; |
| 3171 const intptr_t kNumTemps = 0; | 3304 const intptr_t kNumTemps = 0; |
| 3172 LocationSummary* summary = | 3305 LocationSummary* summary = |
| 3173 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3306 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3174 summary->set_in(0, Location::RequiresFpuRegister()); | 3307 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3175 summary->set_out(Location::RequiresFpuRegister()); | 3308 summary->set_out(Location::RequiresFpuRegister()); |
| 3176 return summary; | 3309 return summary; |
| 3177 } | 3310 } |
| 3178 | 3311 |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4276 PcDescriptors::kOther, | 4409 PcDescriptors::kOther, |
| 4277 locs()); | 4410 locs()); |
| 4278 __ Drop(2); // Discard type arguments and receiver. | 4411 __ Drop(2); // Discard type arguments and receiver. |
| 4279 } | 4412 } |
| 4280 | 4413 |
| 4281 } // namespace dart | 4414 } // namespace dart |
| 4282 | 4415 |
| 4283 #undef __ | 4416 #undef __ |
| 4284 | 4417 |
| 4285 #endif // defined TARGET_ARCH_IA32 | 4418 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |