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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 416 } |
417 if (m.right().IsWord32Xor() && CanCover(node, m.right().node())) { | 417 if (m.right().IsWord32Xor() && CanCover(node, m.right().node())) { |
418 Int32BinopMatcher mright(m.right().node()); | 418 Int32BinopMatcher mright(m.right().node()); |
419 if (mright.right().Is(-1)) { | 419 if (mright.right().Is(-1)) { |
420 EmitBic(this, node, m.left().node(), mright.left().node()); | 420 EmitBic(this, node, m.left().node(), mright.left().node()); |
421 return; | 421 return; |
422 } | 422 } |
423 } | 423 } |
424 if (IsSupported(ARMv7) && m.right().HasValue()) { | 424 if (IsSupported(ARMv7) && m.right().HasValue()) { |
425 uint32_t value = m.right().Value(); | 425 uint32_t value = m.right().Value(); |
426 uint32_t width = base::bits::CountSetBits32(value); | 426 uint32_t width = base::bits::CountPopulation32(value); |
427 uint32_t msb = base::bits::CountLeadingZeros32(value); | 427 uint32_t msb = base::bits::CountLeadingZeros32(value); |
428 if (width != 0 && msb + width == 32) { | 428 if (width != 0 && msb + width == 32) { |
429 DCHECK_EQ(0, base::bits::CountTrailingZeros32(value)); | 429 DCHECK_EQ(0, base::bits::CountTrailingZeros32(value)); |
430 if (m.left().IsWord32Shr()) { | 430 if (m.left().IsWord32Shr()) { |
431 Int32BinopMatcher mleft(m.left().node()); | 431 Int32BinopMatcher mleft(m.left().node()); |
432 if (mleft.right().IsInRange(0, 31)) { | 432 if (mleft.right().IsInRange(0, 31)) { |
433 Emit(kArmUbfx, g.DefineAsRegister(node), | 433 Emit(kArmUbfx, g.DefineAsRegister(node), |
434 g.UseRegister(mleft.left().node()), | 434 g.UseRegister(mleft.left().node()), |
435 g.UseImmediate(mleft.right().node()), g.TempImmediate(width)); | 435 g.UseImmediate(mleft.right().node()), g.TempImmediate(width)); |
436 return; | 436 return; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 529 |
530 void InstructionSelector::VisitWord32Shr(Node* node) { | 530 void InstructionSelector::VisitWord32Shr(Node* node) { |
531 ArmOperandGenerator g(this); | 531 ArmOperandGenerator g(this); |
532 Int32BinopMatcher m(node); | 532 Int32BinopMatcher m(node); |
533 if (IsSupported(ARMv7) && m.left().IsWord32And() && | 533 if (IsSupported(ARMv7) && m.left().IsWord32And() && |
534 m.right().IsInRange(0, 31)) { | 534 m.right().IsInRange(0, 31)) { |
535 int32_t lsb = m.right().Value(); | 535 int32_t lsb = m.right().Value(); |
536 Int32BinopMatcher mleft(m.left().node()); | 536 Int32BinopMatcher mleft(m.left().node()); |
537 if (mleft.right().HasValue()) { | 537 if (mleft.right().HasValue()) { |
538 uint32_t value = (mleft.right().Value() >> lsb) << lsb; | 538 uint32_t value = (mleft.right().Value() >> lsb) << lsb; |
539 uint32_t width = base::bits::CountSetBits32(value); | 539 uint32_t width = base::bits::CountPopulation32(value); |
540 uint32_t msb = base::bits::CountLeadingZeros32(value); | 540 uint32_t msb = base::bits::CountLeadingZeros32(value); |
541 if (msb + width + lsb == 32) { | 541 if (msb + width + lsb == 32) { |
542 DCHECK_EQ(lsb, base::bits::CountTrailingZeros32(value)); | 542 DCHECK_EQ(lsb, base::bits::CountTrailingZeros32(value)); |
543 Emit(kArmUbfx, g.DefineAsRegister(node), | 543 Emit(kArmUbfx, g.DefineAsRegister(node), |
544 g.UseRegister(mleft.left().node()), g.TempImmediate(lsb), | 544 g.UseRegister(mleft.left().node()), g.TempImmediate(lsb), |
545 g.TempImmediate(width)); | 545 g.TempImmediate(width)); |
546 return; | 546 return; |
547 } | 547 } |
548 } | 548 } |
549 } | 549 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 DCHECK(cont->IsSet()); | 959 DCHECK(cont->IsSet()); |
960 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), | 960 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), |
961 g.UseDoubleRegister(m.left().node()), | 961 g.UseDoubleRegister(m.left().node()), |
962 g.UseDoubleRegister(m.right().node())); | 962 g.UseDoubleRegister(m.right().node())); |
963 } | 963 } |
964 } | 964 } |
965 | 965 |
966 } // namespace compiler | 966 } // namespace compiler |
967 } // namespace internal | 967 } // namespace internal |
968 } // namespace v8 | 968 } // namespace v8 |
OLD | NEW |