Add support for the APSR.Q flag

This commit is contained in:
Tillmann Karras 2016-08-06 22:04:52 +01:00 committed by MerryMage
parent 11e0688e5f
commit ccb2aa96a5
4 changed files with 21 additions and 0 deletions

View file

@ -260,6 +260,21 @@ void EmitX64::EmitSetVFlag(IR::Block&, IR::Inst* inst) {
} }
} }
void EmitX64::EmitOrQFlag(IR::Block&, IR::Inst* inst) {
constexpr size_t flag_bit = 27;
constexpr u32 flag_mask = 1u << flag_bit;
IR::Value arg = inst->GetArg(0);
if (arg.IsImmediate()) {
if (arg.GetU1())
code->OR(32, MJitStateCpsr(), Imm32(flag_mask));
} else {
X64Reg to_store = reg_alloc.UseScratchRegister(arg.GetInst(), any_gpr);
code->SHL(32, R(to_store), Imm8(flag_bit));
code->OR(32, MJitStateCpsr(), R(to_store));
}
}
void EmitX64::EmitBXWritePC(IR::Block&, IR::Inst* inst) { void EmitX64::EmitBXWritePC(IR::Block&, IR::Inst* inst) {
const u32 T_bit = 1 << 5; const u32 T_bit = 1 << 5;
auto arg = inst->GetArg(0); auto arg = inst->GetArg(0);

View file

@ -118,6 +118,10 @@ void IREmitter::SetVFlag(const IR::Value& value) {
Inst(IR::Opcode::SetVFlag, {value}); Inst(IR::Opcode::SetVFlag, {value});
} }
void IREmitter::OrQFlag(const IR::Value& value) {
Inst(IR::Opcode::OrQFlag, {value});
}
IR::Value IREmitter::Pack2x32To1x64(const IR::Value& lo, const IR::Value& hi) IR::Value IREmitter::Pack2x32To1x64(const IR::Value& lo, const IR::Value& hi)
{ {
return Inst(IR::Opcode::Pack2x32To1x64, {lo, hi}); return Inst(IR::Opcode::Pack2x32To1x64, {lo, hi});

View file

@ -55,6 +55,7 @@ public:
void SetZFlag(const IR::Value& value); void SetZFlag(const IR::Value& value);
void SetCFlag(const IR::Value& value); void SetCFlag(const IR::Value& value);
void SetVFlag(const IR::Value& value); void SetVFlag(const IR::Value& value);
void OrQFlag(const IR::Value& value);
IR::Value Pack2x32To1x64(const IR::Value& lo, const IR::Value& hi); IR::Value Pack2x32To1x64(const IR::Value& lo, const IR::Value& hi);
IR::Value LeastSignificantWord(const IR::Value& value); IR::Value LeastSignificantWord(const IR::Value& value);

View file

@ -18,6 +18,7 @@ OPCODE(GetCFlag, T::U1,
OPCODE(SetCFlag, T::Void, T::U1 ) OPCODE(SetCFlag, T::Void, T::U1 )
OPCODE(GetVFlag, T::U1, ) OPCODE(GetVFlag, T::U1, )
OPCODE(SetVFlag, T::Void, T::U1 ) OPCODE(SetVFlag, T::Void, T::U1 )
OPCODE(OrQFlag, T::Void, T::U1 )
OPCODE(BXWritePC, T::Void, T::U32 ) OPCODE(BXWritePC, T::Void, T::U32 )
OPCODE(CallSupervisor, T::Void, T::U32 ) OPCODE(CallSupervisor, T::Void, T::U32 )