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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 4719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4730 break; | 4730 break; |
4731 case Token::kSUB: | 4731 case Token::kSUB: |
4732 __ vsubqi(kWord, result, left, right); | 4732 __ vsubqi(kWord, result, left, right); |
4733 break; | 4733 break; |
4734 default: UNREACHABLE(); | 4734 default: UNREACHABLE(); |
4735 } | 4735 } |
4736 } | 4736 } |
4737 | 4737 |
4738 | 4738 |
4739 LocationSummary* MathUnaryInstr::MakeLocationSummary(bool opt) const { | 4739 LocationSummary* MathUnaryInstr::MakeLocationSummary(bool opt) const { |
4740 if ((kind() == MethodRecognizer::kMathSin) || | 4740 if ((kind() == MathUnaryInstr::kSin) || (kind() == MathUnaryInstr::kCos)) { |
4741 (kind() == MethodRecognizer::kMathCos)) { | |
4742 const intptr_t kNumInputs = 1; | 4741 const intptr_t kNumInputs = 1; |
4743 const intptr_t kNumTemps = 0; | 4742 const intptr_t kNumTemps = 0; |
4744 LocationSummary* summary = | 4743 LocationSummary* summary = |
4745 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 4744 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
4746 summary->set_in(0, Location::FpuRegisterLocation(Q0)); | 4745 summary->set_in(0, Location::FpuRegisterLocation(Q0)); |
4747 summary->set_out(0, Location::FpuRegisterLocation(Q0)); | 4746 summary->set_out(0, Location::FpuRegisterLocation(Q0)); |
4748 #if !defined(ARM_FLOAT_ABI_HARD) | 4747 #if !defined(ARM_FLOAT_ABI_HARD) |
4749 summary->AddTemp(Location::RegisterLocation(R0)); | 4748 summary->AddTemp(Location::RegisterLocation(R0)); |
4750 summary->AddTemp(Location::RegisterLocation(R1)); | 4749 summary->AddTemp(Location::RegisterLocation(R1)); |
4751 summary->AddTemp(Location::RegisterLocation(R2)); | 4750 summary->AddTemp(Location::RegisterLocation(R2)); |
4752 summary->AddTemp(Location::RegisterLocation(R3)); | 4751 summary->AddTemp(Location::RegisterLocation(R3)); |
4753 #endif | 4752 #endif |
4754 return summary; | 4753 return summary; |
4755 } | 4754 } |
4756 // Sqrt. | 4755 ASSERT((kind() == MathUnaryInstr::kSqrt) || |
| 4756 (kind() == MathUnaryInstr::kDoubleSquare)); |
4757 const intptr_t kNumInputs = 1; | 4757 const intptr_t kNumInputs = 1; |
4758 const intptr_t kNumTemps = 0; | 4758 const intptr_t kNumTemps = 0; |
4759 LocationSummary* summary = | 4759 LocationSummary* summary = |
4760 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4760 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
4761 summary->set_in(0, Location::RequiresFpuRegister()); | 4761 summary->set_in(0, Location::RequiresFpuRegister()); |
4762 summary->set_out(0, Location::RequiresFpuRegister()); | 4762 summary->set_out(0, Location::RequiresFpuRegister()); |
4763 return summary; | 4763 return summary; |
4764 } | 4764 } |
4765 | 4765 |
4766 | 4766 |
4767 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4767 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4768 if (kind() == MethodRecognizer::kMathSqrt) { | 4768 if (kind() == MathUnaryInstr::kSqrt) { |
4769 DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 4769 DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
4770 DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 4770 DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
4771 __ vsqrtd(result, val); | 4771 __ vsqrtd(result, val); |
| 4772 } else if (kind() == MathUnaryInstr::kDoubleSquare) { |
| 4773 DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 4774 DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 4775 __ vmuld(result, val, val); |
4772 } else { | 4776 } else { |
| 4777 ASSERT((kind() == MathUnaryInstr::kSin) || |
| 4778 (kind() == MathUnaryInstr::kCos)); |
4773 #if defined(ARM_FLOAT_ABI_HARD) | 4779 #if defined(ARM_FLOAT_ABI_HARD) |
4774 __ CallRuntime(TargetFunction(), InputCount()); | 4780 __ CallRuntime(TargetFunction(), InputCount()); |
4775 #else | 4781 #else |
4776 // If we aren't doing "hardfp", then we have to move the double arguments | 4782 // If we aren't doing "hardfp", then we have to move the double arguments |
4777 // to the integer registers, and take the results from the integer | 4783 // to the integer registers, and take the results from the integer |
4778 // registers. | 4784 // registers. |
4779 __ vmovrrd(R0, R1, D0); | 4785 __ vmovrrd(R0, R1, D0); |
4780 __ vmovrrd(R2, R3, D1); | 4786 __ vmovrrd(R2, R3, D1); |
4781 __ CallRuntime(TargetFunction(), InputCount()); | 4787 __ CallRuntime(TargetFunction(), InputCount()); |
4782 __ vmovdrr(D0, R0, R1); | 4788 __ vmovdrr(D0, R0, R1); |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6077 compiler->GenerateCall(token_pos(), | 6083 compiler->GenerateCall(token_pos(), |
6078 &label, | 6084 &label, |
6079 PcDescriptors::kOther, | 6085 PcDescriptors::kOther, |
6080 locs()); | 6086 locs()); |
6081 __ Drop(ArgumentCount()); // Discard arguments. | 6087 __ Drop(ArgumentCount()); // Discard arguments. |
6082 } | 6088 } |
6083 | 6089 |
6084 } // namespace dart | 6090 } // namespace dart |
6085 | 6091 |
6086 #endif // defined TARGET_ARCH_ARM | 6092 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |