Commit 07a743df authored by Ivica Bogosavljevic's avatar Ivica Bogosavljevic Committed by Commit Bot

MIPS[64]: Fix wrong optimization calculation on edge case in

InstructionSelector::VisitInt32Mul

TEST=cctest/test-run-machops/RunInt32MulAndInt32AddP,mjsunit/asm/int32mod-constant

Bug: 
Change-Id: Iaccfc0d0c981e7c7e2f8b06ff3812fe60d1f85d3
Reviewed-on: https://chromium-review.googlesource.com/574367Reviewed-by: 's avatarMiran Karić <Miran.Karic@imgtec.com>
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@imgtec.com>
Cr-Commit-Position: refs/heads/master@{#46707}
parent 9a0403a6
......@@ -730,7 +730,7 @@ void InstructionSelector::VisitInt32Mul(Node* node) {
MipsOperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.right().HasValue() && m.right().Value() > 0) {
int32_t value = m.right().Value();
uint32_t value = static_cast<uint32_t>(m.right().Value());
if (base::bits::IsPowerOfTwo(value)) {
Emit(kMipsShl | AddressingModeField::encode(kMode_None),
g.DefineAsRegister(node), g.UseRegister(m.left().node()),
......
......@@ -979,7 +979,7 @@ void InstructionSelector::VisitInt32Mul(Node* node) {
Mips64OperandGenerator g(this);
Int32BinopMatcher m(node);
if (m.right().HasValue() && m.right().Value() > 0) {
int32_t value = m.right().Value();
uint32_t value = static_cast<uint32_t>(m.right().Value());
if (base::bits::IsPowerOfTwo(value)) {
Emit(kMips64Shl | AddressingModeField::encode(kMode_None),
g.DefineAsRegister(node), g.UseRegister(m.left().node()),
......@@ -1036,7 +1036,7 @@ void InstructionSelector::VisitInt64Mul(Node* node) {
Int64BinopMatcher m(node);
// TODO(dusmil): Add optimization for shifts larger than 32.
if (m.right().HasValue() && m.right().Value() > 0) {
int32_t value = static_cast<int32_t>(m.right().Value());
uint32_t value = static_cast<uint32_t>(m.right().Value());
if (base::bits::IsPowerOfTwo(value)) {
Emit(kMips64Dshl | AddressingModeField::encode(kMode_None),
g.DefineAsRegister(node), g.UseRegister(m.left().node()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment