emit_arm64_data_processing: Implement RotateRightExtended
This commit is contained in:
parent
22d87bcbe5
commit
f642f49b93
1 changed files with 26 additions and 4 deletions
|
@ -645,10 +645,32 @@ void EmitIR<IR::Opcode::RotateRight64>(oaknut::CodeGenerator& code, EmitContext&
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::RotateRightExtended>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
void EmitIR<IR::Opcode::RotateRightExtended>(oaknut::CodeGenerator& code, EmitContext& ctx, IR::Inst* inst) {
|
||||||
(void)code;
|
const auto carry_inst = inst->GetAssociatedPseudoOperation(IR::Opcode::GetCarryFromOp);
|
||||||
(void)ctx;
|
|
||||||
(void)inst;
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
ASSERT_FALSE("Unimplemented");
|
auto Wresult = ctx.reg_alloc.WriteW(inst);
|
||||||
|
auto Woperand = ctx.reg_alloc.ReadW(args[0]);
|
||||||
|
|
||||||
|
if (args[1].IsImmediate()) {
|
||||||
|
RegAlloc::Realize(Wresult, Woperand);
|
||||||
|
|
||||||
|
code.LSR(Wresult, Woperand, 1);
|
||||||
|
if (args[1].GetImmediateU1()) {
|
||||||
|
code.ORR(Wresult, Wresult, 0x8000'0000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
auto Wcarry_in = ctx.reg_alloc.ReadW(args[1]);
|
||||||
|
RegAlloc::Realize(Wresult, Woperand, Wcarry_in);
|
||||||
|
|
||||||
|
code.LSR(Wscratch0, Wcarry_in, 29);
|
||||||
|
code.EXTR(Wresult, Wscratch0, Woperand, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (carry_inst) {
|
||||||
|
auto Wcarry_out = ctx.reg_alloc.WriteW(carry_inst);
|
||||||
|
RegAlloc::Realize(Wcarry_out);
|
||||||
|
code.UBFIZ(Wcarry_out, Woperand, 29, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
Loading…
Reference in a new issue