| Index: src/compiler/x64/instruction-selector-x64.cc
|
| diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc
|
| index 878e778da068c3563b1d06d7446c2411cf82fe28..ed857c57b0af8d5b1c282bc9a4ed3d514b1f5f8a 100644
|
| --- a/src/compiler/x64/instruction-selector-x64.cc
|
| +++ b/src/compiler/x64/instruction-selector-x64.cc
|
| @@ -154,10 +154,18 @@ class X64OperandGenerator final : public OperandGenerator {
|
| }
|
| BaseWithIndexAndDisplacement64Matcher m(operand, AddressOption::kAllowAll);
|
| DCHECK(m.matches());
|
| - if ((m.displacement() == nullptr || CanBeImmediate(m.displacement()))) {
|
| + if (m.displacement() == nullptr || CanBeImmediate(m.displacement())) {
|
| return GenerateMemoryOperandInputs(
|
| m.index(), m.scale(), m.base(), m.displacement(),
|
| m.displacement_mode(), inputs, input_count);
|
| + } else if (m.base() == nullptr &&
|
| + m.displacement_mode() == kPositiveDisplacement) {
|
| + // The displacement cannot be an immediate, but we can use the
|
| + // displacement as base instead and still benefit from addressing
|
| + // modes for the scale.
|
| + return GenerateMemoryOperandInputs(m.index(), m.scale(), m.displacement(),
|
| + nullptr, m.displacement_mode(), inputs,
|
| + input_count);
|
| } else {
|
| inputs[(*input_count)++] = UseRegister(operand->InputAt(0));
|
| inputs[(*input_count)++] = UseRegister(operand->InputAt(1));
|
|
|