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 "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 3674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3685 switch (op_kind()) { | 3685 switch (op_kind()) { |
3686 case Token::kADD: __ addd(result, left, right); break; | 3686 case Token::kADD: __ addd(result, left, right); break; |
3687 case Token::kSUB: __ subd(result, left, right); break; | 3687 case Token::kSUB: __ subd(result, left, right); break; |
3688 case Token::kMUL: __ muld(result, left, right); break; | 3688 case Token::kMUL: __ muld(result, left, right); break; |
3689 case Token::kDIV: __ divd(result, left, right); break; | 3689 case Token::kDIV: __ divd(result, left, right); break; |
3690 default: UNREACHABLE(); | 3690 default: UNREACHABLE(); |
3691 } | 3691 } |
3692 } | 3692 } |
3693 | 3693 |
3694 | 3694 |
3695 LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, | |
3696 bool opt) const { | |
3697 const intptr_t kNumInputs = 1; | |
3698 const intptr_t kNumTemps = 0; | |
3699 LocationSummary* summary = new(zone) LocationSummary( | |
3700 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
3701 summary->set_in(0, Location::RequiresFpuRegister()); | |
3702 summary->set_out(0, Location::RequiresRegister()); | |
3703 return summary; | |
3704 } | |
3705 | |
3706 | |
3707 void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
3708 ASSERT(compiler->is_optimizing()); | |
3709 const DRegister value = locs()->in(0).fpu_reg(); | |
3710 const Register result = locs()->out(0).reg(); | |
3711 if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { | |
3712 Label is_not_nan; | |
3713 __ LoadObject(result, Bool::False()); | |
3714 __ cund(value, value); | |
3715 __ bc1f(&is_not_nan); | |
3716 __ LoadObject(result, Bool::True()); | |
3717 __ Bind(&is_not_nan); | |
3718 } else { | |
3719 ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); | |
3720 Label not_inf, done; | |
3721 __ mfc1(TMP, EvenFRegisterOf(value)); | |
3722 __ mfc1(result, OddFRegisterOf(value)); | |
3723 // If the low word isn't zero, then it isn't infinity. | |
3724 __ bne(TMP, ZR, ¬_inf); | |
3725 // Mask off the sign bit. | |
3726 __ AndImmediate(result, result, 0x7FFFFFFF); | |
3727 // Compare with +infinity. | |
3728 __ BranchNotEqual(result, Immediate(0x7FF00000), ¬_inf); | |
3729 | |
3730 __ LoadObject(result, Bool::True()); | |
3731 __ b(&done); | |
3732 | |
3733 __ Bind(¬_inf); | |
3734 __ LoadObject(result, Bool::False()); | |
3735 __ Bind(&done); | |
3736 } | |
3737 } | |
3738 | |
3739 | |
3740 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, | 3695 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, |
3741 bool opt) const { | 3696 bool opt) const { |
3742 UNIMPLEMENTED(); | 3697 UNIMPLEMENTED(); |
3743 return NULL; | 3698 return NULL; |
3744 } | 3699 } |
3745 | 3700 |
3746 | 3701 |
3747 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3702 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3748 UNIMPLEMENTED(); | 3703 UNIMPLEMENTED(); |
3749 } | 3704 } |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4574 Label try_sqrt; | 4529 Label try_sqrt; |
4575 __ bc1f(&try_sqrt); // Neither 'exp' nor 'base' are NaN. | 4530 __ bc1f(&try_sqrt); // Neither 'exp' nor 'base' are NaN. |
4576 | 4531 |
4577 __ Bind(&return_nan); | 4532 __ Bind(&return_nan); |
4578 __ LoadImmediate(result, NAN); | 4533 __ LoadImmediate(result, NAN); |
4579 __ b(&skip_call); | 4534 __ b(&skip_call); |
4580 | 4535 |
4581 __ Bind(&try_sqrt); | 4536 __ Bind(&try_sqrt); |
4582 // Before calling pow, check if we could use sqrt instead of pow. | 4537 // Before calling pow, check if we could use sqrt instead of pow. |
4583 __ LoadImmediate(result, kPosInfinity); | 4538 __ LoadImmediate(result, kPosInfinity); |
4584 // base == Infinity -> call pow; | 4539 // base == -Infinity -> call pow; |
4585 __ ceqd(base, result); | 4540 __ ceqd(base, result); |
4586 Label do_pow; | 4541 Label do_pow; |
4587 __ bc1t(&do_pow); | 4542 __ b(&do_pow); |
4588 | 4543 |
4589 // exponent == 0.5 ? | 4544 // exponent == 0.5 ? |
4590 __ LoadImmediate(result, 0.5); | 4545 __ LoadImmediate(result, 0.5); |
4591 __ ceqd(base, result); | 4546 __ ceqd(base, result); |
4592 __ bc1f(&do_pow); | 4547 __ bc1f(&do_pow); |
4593 | 4548 |
4594 // base == 0 -> return 0; | 4549 // base == 0 -> return 0; |
4595 __ LoadImmediate(DTMP, 0.0); | 4550 __ LoadImmediate(DTMP, 0.0); |
4596 __ ceqd(base, DTMP); | 4551 __ ceqd(base, DTMP); |
4597 Label return_zero; | 4552 Label return_zero; |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5832 1, | 5787 1, |
5833 locs()); | 5788 locs()); |
5834 __ lw(result, Address(SP, 1 * kWordSize)); | 5789 __ lw(result, Address(SP, 1 * kWordSize)); |
5835 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5790 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5836 } | 5791 } |
5837 | 5792 |
5838 | 5793 |
5839 } // namespace dart | 5794 } // namespace dart |
5840 | 5795 |
5841 #endif // defined TARGET_ARCH_MIPS | 5796 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |