IR: Add ConditionalSelectNZCV instruction
This commit is contained in:
parent
12c6f841c2
commit
dd2a6684fe
4 changed files with 10 additions and 0 deletions
|
@ -176,6 +176,10 @@ void EmitX64::EmitConditionalSelect64(EmitContext& ctx, IR::Inst* inst) {
|
||||||
EmitConditionalSelect(code, ctx, inst, 64);
|
EmitConditionalSelect(code, ctx, inst, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmitX64::EmitConditionalSelectNZCV(EmitContext& ctx, IR::Inst* inst) {
|
||||||
|
EmitConditionalSelect(code, ctx, inst, 32);
|
||||||
|
}
|
||||||
|
|
||||||
static void EmitExtractRegister(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst, int bit_size) {
|
static void EmitExtractRegister(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst, int bit_size) {
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,10 @@ U64 IREmitter::ConditionalSelect(Cond cond, const U64& a, const U64& b) {
|
||||||
return Inst<U64>(Opcode::ConditionalSelect64, Value{cond}, a, b);
|
return Inst<U64>(Opcode::ConditionalSelect64, Value{cond}, a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NZCV IREmitter::ConditionalSelect(Cond cond, const NZCV& a, const NZCV& b) {
|
||||||
|
return Inst<NZCV>(Opcode::ConditionalSelectNZCV, Value{cond}, a, b);
|
||||||
|
}
|
||||||
|
|
||||||
U32U64 IREmitter::ConditionalSelect(Cond cond, const U32U64& a, const U32U64& b) {
|
U32U64 IREmitter::ConditionalSelect(Cond cond, const U32U64& a, const U32U64& b) {
|
||||||
ASSERT(a.GetType() == b.GetType());
|
ASSERT(a.GetType() == b.GetType());
|
||||||
if (a.GetType() == Type::U32) {
|
if (a.GetType() == Type::U32) {
|
||||||
|
|
|
@ -79,6 +79,7 @@ public:
|
||||||
U1 TestBit(const U32U64& value, const U8& bit);
|
U1 TestBit(const U32U64& value, const U8& bit);
|
||||||
U32 ConditionalSelect(Cond cond, const U32& a, const U32& b);
|
U32 ConditionalSelect(Cond cond, const U32& a, const U32& b);
|
||||||
U64 ConditionalSelect(Cond cond, const U64& a, const U64& b);
|
U64 ConditionalSelect(Cond cond, const U64& a, const U64& b);
|
||||||
|
NZCV ConditionalSelect(Cond cond, const NZCV& a, const NZCV& b);
|
||||||
U32U64 ConditionalSelect(Cond cond, const U32U64& a, const U32U64& b);
|
U32U64 ConditionalSelect(Cond cond, const U32U64& a, const U32U64& b);
|
||||||
|
|
||||||
NZCV NZCVFromPackedFlags(const U32& a);
|
NZCV NZCVFromPackedFlags(const U32& a);
|
||||||
|
|
|
@ -82,6 +82,7 @@ OPCODE(IsZero64, T::U1, T::U64
|
||||||
OPCODE(TestBit, T::U1, T::U64, T::U8 )
|
OPCODE(TestBit, T::U1, T::U64, T::U8 )
|
||||||
OPCODE(ConditionalSelect32, T::U32, T::Cond, T::U32, T::U32 )
|
OPCODE(ConditionalSelect32, T::U32, T::Cond, T::U32, T::U32 )
|
||||||
OPCODE(ConditionalSelect64, T::U64, T::Cond, T::U64, T::U64 )
|
OPCODE(ConditionalSelect64, T::U64, T::Cond, T::U64, T::U64 )
|
||||||
|
OPCODE(ConditionalSelectNZCV, T::NZCVFlags, T::Cond, T::NZCVFlags, T::NZCVFlags )
|
||||||
OPCODE(LogicalShiftLeft32, T::U32, T::U32, T::U8, T::U1 )
|
OPCODE(LogicalShiftLeft32, T::U32, T::U32, T::U8, T::U1 )
|
||||||
OPCODE(LogicalShiftLeft64, T::U64, T::U64, T::U8 )
|
OPCODE(LogicalShiftLeft64, T::U64, T::U64, T::U8 )
|
||||||
OPCODE(LogicalShiftRight32, T::U32, T::U32, T::U8, T::U1 )
|
OPCODE(LogicalShiftRight32, T::U32, T::U32, T::U8, T::U1 )
|
||||||
|
|
Loading…
Reference in a new issue