Index: src/compiler/mips64/instruction-selector-mips64.cc |
diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc |
index 838b263d687e86f636e25e1a03d49f3d7af69325..ce80df79b2b3323fa56aaefdceba8579b024a58f 100644 |
--- a/src/compiler/mips64/instruction-selector-mips64.cc |
+++ b/src/compiler/mips64/instruction-selector-mips64.cc |
@@ -286,6 +286,17 @@ void InstructionSelector::VisitWord32Sar(Node* node) { |
void InstructionSelector::VisitWord64Shl(Node* node) { |
+ Mips64OperandGenerator g(this); |
+ Int64BinopMatcher m(node); |
+ if ((m.left().IsChangeInt32ToInt64() || m.left().IsChangeUint32ToUint64()) && |
+ m.right().IsInRange(32, 63)) { |
+ // There's no need to sign/zero-extend to 64-bit if we shift out the upper |
+ // 32 bits anyway. |
+ Emit(kMips64Dshl, g.DefineSameAsFirst(node), |
+ g.UseRegister(m.left().node()->InputAt(0)), |
+ g.UseImmediate(m.right().node())); |
+ return; |
+ } |
VisitRRO(this, kMips64Dshl, node); |
} |
@@ -529,6 +540,23 @@ void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { |
Mips64OperandGenerator g(this); |
+ Node* value = node->InputAt(0); |
+ if (CanCover(node, value)) { |
+ switch (value->opcode()) { |
+ case IrOpcode::kWord64Sar: { |
+ Int64BinopMatcher m(value); |
+ if (m.right().IsInRange(32, 63)) { |
+ // After smi untagging no need for truncate. Combine sequence. |
+ Emit(kMips64Dsar, g.DefineSameAsFirst(node), |
+ g.UseRegister(m.left().node()), g.TempImmediate(kSmiShift)); |
+ return; |
+ } |
+ break; |
+ } |
+ default: |
+ break; |
+ } |
+ } |
Emit(kMips64Ext, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), |
g.TempImmediate(0), g.TempImmediate(32)); |
} |