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/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 } else if (is_add_sub && can_commute && | 429 } else if (is_add_sub && can_commute && |
430 TryMatchAnyExtend(&g, selector, node, right_node, left_node, | 430 TryMatchAnyExtend(&g, selector, node, right_node, left_node, |
431 &inputs[0], &inputs[1], &opcode)) { | 431 &inputs[0], &inputs[1], &opcode)) { |
432 if (must_commute_cond) cont->Commute(); | 432 if (must_commute_cond) cont->Commute(); |
433 input_count += 2; | 433 input_count += 2; |
434 } else if (TryMatchAnyShift(selector, node, right_node, &opcode, | 434 } else if (TryMatchAnyShift(selector, node, right_node, &opcode, |
435 !is_add_sub)) { | 435 !is_add_sub)) { |
436 Matcher m_shift(right_node); | 436 Matcher m_shift(right_node); |
437 inputs[input_count++] = g.UseRegisterOrImmediateZero(left_node); | 437 inputs[input_count++] = g.UseRegisterOrImmediateZero(left_node); |
438 inputs[input_count++] = g.UseRegister(m_shift.left().node()); | 438 inputs[input_count++] = g.UseRegister(m_shift.left().node()); |
439 inputs[input_count++] = g.UseImmediate(m_shift.right().node()); | 439 // We only need at most the last 6 bits of the shift. |
| 440 inputs[input_count++] = |
| 441 g.UseImmediate(static_cast<int>(m_shift.right().Value() & 0x3F)); |
440 } else if (can_commute && TryMatchAnyShift(selector, node, left_node, &opcode, | 442 } else if (can_commute && TryMatchAnyShift(selector, node, left_node, &opcode, |
441 !is_add_sub)) { | 443 !is_add_sub)) { |
442 if (must_commute_cond) cont->Commute(); | 444 if (must_commute_cond) cont->Commute(); |
443 Matcher m_shift(left_node); | 445 Matcher m_shift(left_node); |
444 inputs[input_count++] = g.UseRegisterOrImmediateZero(right_node); | 446 inputs[input_count++] = g.UseRegisterOrImmediateZero(right_node); |
445 inputs[input_count++] = g.UseRegister(m_shift.left().node()); | 447 inputs[input_count++] = g.UseRegister(m_shift.left().node()); |
446 inputs[input_count++] = g.UseImmediate(m_shift.right().node()); | 448 // We only need at most the last 6 bits of the shift. |
| 449 inputs[input_count++] = |
| 450 g.UseImmediate(static_cast<int>(m_shift.right().Value() & 0x3F)); |
447 } else { | 451 } else { |
448 inputs[input_count++] = g.UseRegisterOrImmediateZero(left_node); | 452 inputs[input_count++] = g.UseRegisterOrImmediateZero(left_node); |
449 inputs[input_count++] = g.UseRegister(right_node); | 453 inputs[input_count++] = g.UseRegister(right_node); |
450 } | 454 } |
451 | 455 |
452 if (cont->IsBranch()) { | 456 if (cont->IsBranch()) { |
453 inputs[input_count++] = g.Label(cont->true_block()); | 457 inputs[input_count++] = g.Label(cont->true_block()); |
454 inputs[input_count++] = g.Label(cont->false_block()); | 458 inputs[input_count++] = g.Label(cont->false_block()); |
455 } | 459 } |
456 | 460 |
(...skipping 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 // static | 2708 // static |
2705 MachineOperatorBuilder::AlignmentRequirements | 2709 MachineOperatorBuilder::AlignmentRequirements |
2706 InstructionSelector::AlignmentRequirements() { | 2710 InstructionSelector::AlignmentRequirements() { |
2707 return MachineOperatorBuilder::AlignmentRequirements:: | 2711 return MachineOperatorBuilder::AlignmentRequirements:: |
2708 FullUnalignedAccessSupport(); | 2712 FullUnalignedAccessSupport(); |
2709 } | 2713 } |
2710 | 2714 |
2711 } // namespace compiler | 2715 } // namespace compiler |
2712 } // namespace internal | 2716 } // namespace internal |
2713 } // namespace v8 | 2717 } // namespace v8 |
OLD | NEW |