Index: src/mips/disasm-mips.cc |
diff --git a/src/mips/disasm-mips.cc b/src/mips/disasm-mips.cc |
index f24ec436f0064ef6162f4809f68d3c5e619a614a..512e6f3f86db8db4fe0e9be4e4a6353f617b772e 100644 |
--- a/src/mips/disasm-mips.cc |
+++ b/src/mips/disasm-mips.cc |
@@ -1377,12 +1377,12 @@ void Decoder::DecodeTypeImmediate(Instruction* instr) { |
Format(instr, "blez 'rs, 'imm16u -> 'imm16p4s2"); |
} else if ((instr->RtValue() != instr->RsValue()) && |
(instr->RsValue() != 0) && (instr->RtValue() != 0)) { |
- Format(instr, "bgeuc 'rs, 'rt, 'imm16u -> 'imm16p4s2"); |
+ Format(instr, "bgeuc 'rs, 'rt, 'imm16u -> 'imm16p4s2"); |
} else if ((instr->RtValue() == instr->RsValue()) && |
(instr->RtValue() != 0)) { |
- Format(instr, "bgezalc 'rs, 'imm16u -> 'imm16p4s2"); |
+ Format(instr, "bgezalc 'rs, 'imm16u -> 'imm16p4s2"); |
} else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) { |
- Format(instr, "blezalc 'rt, 'imm16u -> 'imm16p4s2"); |
+ Format(instr, "blezalc 'rt, 'imm16u -> 'imm16p4s2"); |
} else { |
UNREACHABLE(); |
} |
@@ -1419,7 +1419,7 @@ void Decoder::DecodeTypeImmediate(Instruction* instr) { |
Format(instr, "bltzc 'rt, 'imm16u -> 'imm16p4s2"); |
} else if ((instr->RtValue() != instr->RsValue()) && |
(instr->RsValue() != 0) && (instr->RtValue() != 0)) { |
- Format(instr, "bltc 'rs, 'rt, 'imm16u -> 'imm16p4s2"); |
+ Format(instr, "bltc 'rs, 'rt, 'imm16u -> 'imm16p4s2"); |
} else if ((instr->RsValue() == 0) && (instr->RtValue() != 0)) { |
Format(instr, "bgtzc 'rt, 'imm16u -> 'imm16p4s2"); |
} else { |
@@ -1445,25 +1445,33 @@ void Decoder::DecodeTypeImmediate(Instruction* instr) { |
if (!IsMipsArchVariant(kMips32r6)) { |
Format(instr, "addi 'rt, 'rs, 'imm16s"); |
} else { |
- // Check if BOVC or BEQC instruction. |
- if (instr->RsValue() >= instr->RtValue()) { |
+ int rs_reg = instr->RsValue(); |
+ int rt_reg = instr->RtValue(); |
+ // Check if BOVC, BEQZALC or BEQC instruction. |
+ if (rs_reg >= rt_reg) { |
Format(instr, "bovc 'rs, 'rt, 'imm16s -> 'imm16p4s2"); |
- } else if (instr->RsValue() < instr->RtValue()) { |
- Format(instr, "beqc 'rs, 'rt, 'imm16s -> 'imm16p4s2"); |
} else { |
- UNREACHABLE(); |
+ if (rs_reg == 0) { |
+ Format(instr, "beqzalc 'rt, 'imm16s -> 'imm16p4s2"); |
+ } else { |
+ Format(instr, "beqc 'rs, 'rt, 'imm16s -> 'imm16p4s2"); |
+ } |
} |
} |
break; |
case DADDI: |
if (IsMipsArchVariant(kMips32r6)) { |
- // Check if BNVC or BNEC instruction. |
- if (instr->RsValue() >= instr->RtValue()) { |
+ int rs_reg = instr->RsValue(); |
+ int rt_reg = instr->RtValue(); |
+ // Check if BNVC, BNEZALC or BNEC instruction. |
+ if (rs_reg >= rt_reg) { |
Format(instr, "bnvc 'rs, 'rt, 'imm16s -> 'imm16p4s2"); |
- } else if (instr->RsValue() < instr->RtValue()) { |
- Format(instr, "bnec 'rs, 'rt, 'imm16s -> 'imm16p4s2"); |
} else { |
- UNREACHABLE(); |
+ if (rs_reg == 0) { |
+ Format(instr, "bnezalc 'rt, 'imm16s -> 'imm16p4s2"); |
+ } else { |
+ Format(instr, "bnec 'rs, 'rt, 'imm16s -> 'imm16p4s2"); |
+ } |
} |
} |
break; |