Index: src/compiler/mips/instruction-selector-mips.cc |
diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc |
index faae1bfeef7bfa1cc62d88ec32e29487127ee333..b84c44aaf502a88ffc7b8f64cf65ac63d5136946 100644 |
--- a/src/compiler/mips/instruction-selector-mips.cc |
+++ b/src/compiler/mips/instruction-selector-mips.cc |
@@ -407,6 +407,24 @@ void InstructionSelector::VisitWord32Shr(Node* node) { |
void InstructionSelector::VisitWord32Sar(Node* node) { |
+ Int32BinopMatcher m(node); |
+ if (m.left().IsWord32Shl() && CanCover(node, m.left().node())) { |
+ Int32BinopMatcher mleft(m.left().node()); |
+ if (m.right().HasValue() && mleft.right().HasValue()) { |
+ MipsOperandGenerator g(this); |
+ uint32_t sar = m.right().Value(); |
+ uint32_t shl = mleft.right().Value(); |
+ if ((sar == shl) && (sar == 16)) { |
+ Emit(kMipsSeh, g.DefineAsRegister(node), |
+ g.UseRegister(mleft.left().node())); |
+ return; |
+ } else if ((sar == shl) && (sar == 24)) { |
+ Emit(kMipsSeb, g.DefineAsRegister(node), |
+ g.UseRegister(mleft.left().node())); |
+ return; |
+ } |
+ } |
+ } |
VisitRRO(this, kMipsSar, node); |
} |