thumb32: Implement B (T4)

This commit is contained in:
MerryMage 2021-03-06 17:20:37 +00:00
parent 47ab3a1450
commit 86aa3f0701
3 changed files with 18 additions and 1 deletions

View file

@ -124,7 +124,7 @@ INST(thumb32_UDF, "UDF", "111101111111----1010--
// Branch instructions // Branch instructions
INST(thumb32_BL_imm, "BL (imm)", "11110Svvvvvvvvvv11j1jvvvvvvvvvvv") // v4T INST(thumb32_BL_imm, "BL (imm)", "11110Svvvvvvvvvv11j1jvvvvvvvvvvv") // v4T
INST(thumb32_BLX_imm, "BLX (imm)", "11110Svvvvvvvvvv11j0jvvvvvvvvvvv") // v5T INST(thumb32_BLX_imm, "BLX (imm)", "11110Svvvvvvvvvv11j0jvvvvvvvvvvv") // v5T
//INST(thumb32_B, "B", "11110-----------10-1------------") INST(thumb32_B, "B", "11110Svvvvvvvvvv10j1jvvvvvvvvvvv")
//INST(thumb32_B_cond, "B (cond)", "11110-----------10-0------------") //INST(thumb32_B_cond, "B (cond)", "11110-----------10-0------------")
// Store Single Data Item // Store Single Data Item

View file

@ -52,4 +52,20 @@ bool ThumbTranslatorVisitor::thumb32_BLX_imm(Imm<1> S, Imm<10> hi, Imm<1> j1, Im
return false; return false;
} }
bool ThumbTranslatorVisitor::thumb32_B(Imm<1> S, Imm<10> hi, Imm<1> j1, Imm<1> j2, Imm<11> lo) {
const Imm<1> i1{j1 == S};
const Imm<1> i2{j2 == S};
if (ir.current_location.IT().IsInITBlock() && !ir.current_location.IT().IsLastInITBlock()) {
return UnpredictableInstruction();
}
const s32 imm32 = static_cast<s32>((concatenate(S, i1, i2, hi, lo).SignExtend<u32>() << 1) + 4);
const auto new_location = ir.current_location
.AdvancePC(imm32)
.AdvanceIT();
ir.SetTerm(IR::Term::LinkBlock{new_location});
return false;
}
} // namespace Dynarmic::A32 } // namespace Dynarmic::A32

View file

@ -199,6 +199,7 @@ struct ThumbTranslatorVisitor final {
// thumb32 branch instructions // thumb32 branch instructions
bool thumb32_BL_imm(Imm<1> S, Imm<10> hi, Imm<1> j1, Imm<1> j2, Imm<11> lo); bool thumb32_BL_imm(Imm<1> S, Imm<10> hi, Imm<1> j1, Imm<1> j2, Imm<11> lo);
bool thumb32_BLX_imm(Imm<1> S, Imm<10> hi, Imm<1> j1, Imm<1> j2, Imm<11> lo); bool thumb32_BLX_imm(Imm<1> S, Imm<10> hi, Imm<1> j1, Imm<1> j2, Imm<11> lo);
bool thumb32_B(Imm<1> S, Imm<10> hi, Imm<1> j1, Imm<1> j2, Imm<11> lo);
// thumb32 store single data item instructions // thumb32 store single data item instructions
bool thumb32_STRB(Reg n, Reg t, Imm<2> imm2, Reg m); bool thumb32_STRB(Reg n, Reg t, Imm<2> imm2, Reg m);