Commit d5986f7f authored by dusan.milosavljevic's avatar dusan.milosavljevic Committed by Commit bot

MIPS64: Fix bugs in branches for unsigned conditions.

TEST=cctest/test-branch-combine
BUG=

Review URL: https://codereview.chromium.org/1017733002

Cr-Commit-Position: refs/heads/master@{#27245}
parent cd9b6ec2
......@@ -2122,7 +2122,7 @@ void MacroAssembler::BranchShort(int16_t offset, Condition cond, Register rs,
// Unsigned comparison.
case Ugreater:
if (r2.is(zero_reg)) {
bgtz(rs, offset);
bne(rs, zero_reg, offset);
} else {
sltu(scratch, r2, rs);
bne(scratch, zero_reg, offset);
......@@ -2130,7 +2130,7 @@ void MacroAssembler::BranchShort(int16_t offset, Condition cond, Register rs,
break;
case Ugreater_equal:
if (r2.is(zero_reg)) {
bgez(rs, offset);
b(offset);
} else {
sltu(scratch, rs, r2);
beq(scratch, zero_reg, offset);
......@@ -2147,7 +2147,7 @@ void MacroAssembler::BranchShort(int16_t offset, Condition cond, Register rs,
break;
case Uless_equal:
if (r2.is(zero_reg)) {
b(offset);
beq(rs, zero_reg, offset);
} else {
sltu(scratch, r2, rs);
beq(scratch, zero_reg, offset);
......@@ -2237,7 +2237,7 @@ void MacroAssembler::BranchShort(int16_t offset, Condition cond, Register rs,
// Unsigned comparison.
case Ugreater:
if (rt.imm64_ == 0) {
bgtz(rs, offset);
bne(rs, zero_reg, offset);
} else {
r2 = scratch;
li(r2, rt);
......@@ -2247,7 +2247,7 @@ void MacroAssembler::BranchShort(int16_t offset, Condition cond, Register rs,
break;
case Ugreater_equal:
if (rt.imm64_ == 0) {
bgez(rs, offset);
b(offset);
} else if (is_int16(rt.imm64_)) {
sltiu(scratch, rs, rt.imm64_);
beq(scratch, zero_reg, offset);
......@@ -2274,7 +2274,7 @@ void MacroAssembler::BranchShort(int16_t offset, Condition cond, Register rs,
break;
case Uless_equal:
if (rt.imm64_ == 0) {
b(offset);
beq(rs, zero_reg, offset);
} else {
r2 = scratch;
li(r2, rt);
......@@ -2376,7 +2376,7 @@ void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs,
case Ugreater:
if (r2.is(zero_reg)) {
offset = shifted_branch_offset(L, false);
bgtz(rs, offset);
bne(rs, zero_reg, offset);
} else {
sltu(scratch, r2, rs);
offset = shifted_branch_offset(L, false);
......@@ -2386,7 +2386,7 @@ void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs,
case Ugreater_equal:
if (r2.is(zero_reg)) {
offset = shifted_branch_offset(L, false);
bgez(rs, offset);
b(offset);
} else {
sltu(scratch, rs, r2);
offset = shifted_branch_offset(L, false);
......@@ -2406,7 +2406,7 @@ void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs,
case Uless_equal:
if (r2.is(zero_reg)) {
offset = shifted_branch_offset(L, false);
b(offset);
beq(rs, zero_reg, offset);
} else {
sltu(scratch, r2, rs);
offset = shifted_branch_offset(L, false);
......@@ -2528,7 +2528,7 @@ void MacroAssembler::BranchShort(Label* L, Condition cond, Register rs,
case Ugreater_equal:
if (rt.imm64_ == 0) {
offset = shifted_branch_offset(L, false);
bgez(rs, offset);
b(offset);
} else if (is_int16(rt.imm64_)) {
sltiu(scratch, rs, rt.imm64_);
offset = shifted_branch_offset(L, false);
......
......@@ -2976,7 +2976,7 @@ void Simulator::DecodeTypeImmediate(Instruction* instr) {
alu_out = (rs < se_imm16) ? 1 : 0;
break;
case SLTIU:
alu_out = (rs_u < static_cast<uint32_t>(se_imm16)) ? 1 : 0;
alu_out = (rs_u < static_cast<uint64_t>(se_imm16)) ? 1 : 0;
break;
case ANDI:
alu_out = rs & oe_imm16;
......
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