| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3078 summary->set_out(Location::RequiresFpuRegister()); | 3078 summary->set_out(Location::RequiresFpuRegister()); |
| 3079 return summary; | 3079 return summary; |
| 3080 } | 3080 } |
| 3081 | 3081 |
| 3082 | 3082 |
| 3083 void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3083 void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3084 __ sqrtd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); | 3084 __ sqrtd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg()); |
| 3085 } | 3085 } |
| 3086 | 3086 |
| 3087 | 3087 |
| 3088 LocationSummary* MathMinMaxInstr::MakeLocationSummary() const { |
| 3089 if (result_cid() == kDoubleCid) { |
| 3090 const intptr_t kNumInputs = 2; |
| 3091 const intptr_t kNumTemps = 1; |
| 3092 LocationSummary* summary = |
| 3093 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3094 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3095 summary->set_in(1, Location::RequiresFpuRegister()); |
| 3096 summary->set_temp(0, Location::RequiresRegister()); |
| 3097 summary->set_out(Location::RequiresFpuRegister()); |
| 3098 return summary; |
| 3099 } |
| 3100 ASSERT(result_cid() == kSmiCid); |
| 3101 UNIMPLEMENTED(); |
| 3102 return NULL; |
| 3103 } |
| 3104 |
| 3105 |
| 3106 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3107 if (result_cid() == kDoubleCid) { |
| 3108 Label done, is_nan, is_left; |
| 3109 DRegister left = locs()->in(0).fpu_reg(); |
| 3110 DRegister right = locs()->in(1).fpu_reg(); |
| 3111 DRegister result = locs()->out().fpu_reg(); |
| 3112 Register temp = locs()->temp(0).reg(); |
| 3113 __ cund(left, right); |
| 3114 __ bc1t(&is_nan); |
| 3115 if (op_kind() == MethodRecognizer::kMathMin) { |
| 3116 __ coltd(left, right); |
| 3117 } else { |
| 3118 ASSERT(op_kind() == MethodRecognizer::kMathMax); |
| 3119 __ coltd(right, left); |
| 3120 } |
| 3121 // TODO(zra): Add conditional moves. |
| 3122 __ bc1t(&is_left); |
| 3123 __ movd(result, right); |
| 3124 __ b(&done); |
| 3125 __ Bind(&is_left); |
| 3126 __ movd(result, right); |
| 3127 __ b(&done); |
| 3128 __ Bind(&is_nan); |
| 3129 __ LoadImmediate(result, NAN); |
| 3130 __ Bind(&done); |
| 3131 return; |
| 3132 } |
| 3133 ASSERT(result_cid() == kSmiCid); |
| 3134 UNIMPLEMENTED(); |
| 3135 } |
| 3136 |
| 3137 |
| 3088 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { | 3138 LocationSummary* UnarySmiOpInstr::MakeLocationSummary() const { |
| 3089 const intptr_t kNumInputs = 1; | 3139 const intptr_t kNumInputs = 1; |
| 3090 const intptr_t kNumTemps = 0; | 3140 const intptr_t kNumTemps = 0; |
| 3091 LocationSummary* summary = | 3141 LocationSummary* summary = |
| 3092 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3142 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3093 summary->set_in(0, Location::RequiresRegister()); | 3143 summary->set_in(0, Location::RequiresRegister()); |
| 3094 // We make use of 3-operand instructions by not requiring result register | 3144 // We make use of 3-operand instructions by not requiring result register |
| 3095 // to be identical to first input register as on Intel. | 3145 // to be identical to first input register as on Intel. |
| 3096 summary->set_out(Location::RequiresRegister()); | 3146 summary->set_out(Location::RequiresRegister()); |
| 3097 return summary; | 3147 return summary; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3230 result->set_in(0, Location::FpuRegisterLocation(D6)); | 3280 result->set_in(0, Location::FpuRegisterLocation(D6)); |
| 3231 if (InputCount() == 2) { | 3281 if (InputCount() == 2) { |
| 3232 result->set_in(1, Location::FpuRegisterLocation(D7)); | 3282 result->set_in(1, Location::FpuRegisterLocation(D7)); |
| 3233 } | 3283 } |
| 3234 result->set_out(Location::FpuRegisterLocation(D0)); | 3284 result->set_out(Location::FpuRegisterLocation(D0)); |
| 3235 return result; | 3285 return result; |
| 3236 } | 3286 } |
| 3237 | 3287 |
| 3238 | 3288 |
| 3239 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3289 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3240 // For pow-function return NAN if exponent is NAN. | 3290 // For pow-function return NaN if exponent is NaN. |
| 3241 Label do_call, skip_call; | 3291 Label do_call, skip_call; |
| 3242 if (recognized_kind() == MethodRecognizer::kDoublePow) { | 3292 if (recognized_kind() == MethodRecognizer::kDoublePow) { |
| 3243 DRegister exp = locs()->in(1).fpu_reg(); | 3293 DRegister exp = locs()->in(1).fpu_reg(); |
| 3244 __ cund(exp, exp); | 3294 __ cund(exp, exp); |
| 3245 __ bc1f(&do_call); | 3295 __ bc1f(&do_call); |
| 3246 // Exponent is NaN, return NaN. | 3296 // Exponent is NaN, return NaN. |
| 3247 __ movd(locs()->out().fpu_reg(), exp); | 3297 __ movd(locs()->out().fpu_reg(), exp); |
| 3248 __ b(&skip_call); | 3298 __ b(&skip_call); |
| 3249 } | 3299 } |
| 3250 __ Bind(&do_call); | 3300 __ Bind(&do_call); |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3773 compiler->GenerateCall(token_pos(), | 3823 compiler->GenerateCall(token_pos(), |
| 3774 &label, | 3824 &label, |
| 3775 PcDescriptors::kOther, | 3825 PcDescriptors::kOther, |
| 3776 locs()); | 3826 locs()); |
| 3777 __ Drop(2); // Discard type arguments and receiver. | 3827 __ Drop(2); // Discard type arguments and receiver. |
| 3778 } | 3828 } |
| 3779 | 3829 |
| 3780 } // namespace dart | 3830 } // namespace dart |
| 3781 | 3831 |
| 3782 #endif // defined TARGET_ARCH_MIPS | 3832 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |