A32: Resolve parameter discrepancies discovered via use of the Imm template
This commit is contained in:
parent
4ba2318b2e
commit
bac945f2d8
2 changed files with 8 additions and 8 deletions
|
@ -216,13 +216,13 @@ public:
|
||||||
return fmt::format("ldrh {}, [{}, #{}]", t, n, imm32);
|
return fmt::format("ldrh {}, [{}, #{}]", t, n, imm32);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string thumb16_STR_imm_t2(Reg t, Imm<5> imm5) {
|
std::string thumb16_STR_imm_t2(Reg t, Imm<8> imm8) {
|
||||||
const u32 imm32 = imm5.ZeroExtend() << 2;
|
const u32 imm32 = imm8.ZeroExtend() << 2;
|
||||||
return fmt::format("str {}, [sp, #{}]", t, imm32);
|
return fmt::format("str {}, [sp, #{}]", t, imm32);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string thumb16_LDR_imm_t2(Reg t, Imm<5> imm5) {
|
std::string thumb16_LDR_imm_t2(Reg t, Imm<8> imm8) {
|
||||||
const u32 imm32 = imm5.ZeroExtend() << 2;
|
const u32 imm32 = imm8.ZeroExtend() << 2;
|
||||||
return fmt::format("ldr {}, [sp, #{}]", t, imm32);
|
return fmt::format("ldr {}, [sp, #{}]", t, imm32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -604,8 +604,8 @@ struct ThumbTranslatorVisitor final {
|
||||||
|
|
||||||
// STR <Rt>, [<Rn>, #<imm>]
|
// STR <Rt>, [<Rn>, #<imm>]
|
||||||
// Rt cannot encode R15.
|
// Rt cannot encode R15.
|
||||||
bool thumb16_STR_imm_t2(Reg t, Imm<5> imm5) {
|
bool thumb16_STR_imm_t2(Reg t, Imm<8> imm8) {
|
||||||
const u32 imm32 = imm5.ZeroExtend() << 2;
|
const u32 imm32 = imm8.ZeroExtend() << 2;
|
||||||
const Reg n = Reg::SP;
|
const Reg n = Reg::SP;
|
||||||
const auto address = ir.Add(ir.GetRegister(n), ir.Imm32(imm32));
|
const auto address = ir.Add(ir.GetRegister(n), ir.Imm32(imm32));
|
||||||
const auto data = ir.GetRegister(t);
|
const auto data = ir.GetRegister(t);
|
||||||
|
@ -616,8 +616,8 @@ struct ThumbTranslatorVisitor final {
|
||||||
|
|
||||||
// LDR <Rt>, [<Rn>, #<imm>]
|
// LDR <Rt>, [<Rn>, #<imm>]
|
||||||
// Rt cannot encode R15.
|
// Rt cannot encode R15.
|
||||||
bool thumb16_LDR_imm_t2(Reg t, Imm<5> imm5) {
|
bool thumb16_LDR_imm_t2(Reg t, Imm<8> imm8) {
|
||||||
const u32 imm32 = imm5.ZeroExtend() << 2;
|
const u32 imm32 = imm8.ZeroExtend() << 2;
|
||||||
const Reg n = Reg::SP;
|
const Reg n = Reg::SP;
|
||||||
const auto address = ir.Add(ir.GetRegister(n), ir.Imm32(imm32));
|
const auto address = ir.Add(ir.GetRegister(n), ir.Imm32(imm32));
|
||||||
const auto data = ir.ReadMemory32(address);
|
const auto data = ir.ReadMemory32(address);
|
||||||
|
|
Loading…
Reference in a new issue