OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 } | 589 } |
590 VisitBinop(this, node, kArmSub, kArmRsb); | 590 VisitBinop(this, node, kArmSub, kArmRsb); |
591 } | 591 } |
592 | 592 |
593 | 593 |
594 void InstructionSelector::VisitInt32Mul(Node* node) { | 594 void InstructionSelector::VisitInt32Mul(Node* node) { |
595 ArmOperandGenerator g(this); | 595 ArmOperandGenerator g(this); |
596 Int32BinopMatcher m(node); | 596 Int32BinopMatcher m(node); |
597 if (m.right().HasValue() && m.right().Value() > 0) { | 597 if (m.right().HasValue() && m.right().Value() > 0) { |
598 int32_t value = m.right().Value(); | 598 int32_t value = m.right().Value(); |
599 if (IsPowerOf2(value - 1)) { | 599 if (base::bits::IsPowerOfTwo32(value - 1)) { |
600 Emit(kArmAdd | AddressingModeField::encode(kMode_Operand2_R_LSL_I), | 600 Emit(kArmAdd | AddressingModeField::encode(kMode_Operand2_R_LSL_I), |
601 g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 601 g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
602 g.UseRegister(m.left().node()), | 602 g.UseRegister(m.left().node()), |
603 g.TempImmediate(WhichPowerOf2(value - 1))); | 603 g.TempImmediate(WhichPowerOf2(value - 1))); |
604 return; | 604 return; |
605 } | 605 } |
606 if (value < kMaxInt && IsPowerOf2(value + 1)) { | 606 if (value < kMaxInt && base::bits::IsPowerOfTwo32(value + 1)) { |
607 Emit(kArmRsb | AddressingModeField::encode(kMode_Operand2_R_LSL_I), | 607 Emit(kArmRsb | AddressingModeField::encode(kMode_Operand2_R_LSL_I), |
608 g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 608 g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
609 g.UseRegister(m.left().node()), | 609 g.UseRegister(m.left().node()), |
610 g.TempImmediate(WhichPowerOf2(value + 1))); | 610 g.TempImmediate(WhichPowerOf2(value + 1))); |
611 return; | 611 return; |
612 } | 612 } |
613 } | 613 } |
614 Emit(kArmMul, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 614 Emit(kArmMul, g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
615 g.UseRegister(m.right().node())); | 615 g.UseRegister(m.right().node())); |
616 } | 616 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } else { | 952 } else { |
953 DCHECK(cont->IsSet()); | 953 DCHECK(cont->IsSet()); |
954 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), | 954 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), |
955 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); | 955 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); |
956 } | 956 } |
957 } | 957 } |
958 | 958 |
959 } // namespace compiler | 959 } // namespace compiler |
960 } // namespace internal | 960 } // namespace internal |
961 } // namespace v8 | 961 } // namespace v8 |
OLD | NEW |