IR: Implement Conditional Select

This commit is contained in:
MerryMage 2018-01-18 11:36:48 +00:00
parent 7992a319ba
commit 6395f09f94
9 changed files with 126 additions and 0 deletions

View file

@ -91,6 +91,23 @@ U1 IREmitter::TestBit(const U32U64& value, const U8& bit) {
}
}
U32 IREmitter::ConditionalSelect(Cond cond, const U32& a, const U32& b) {
return Inst<U32>(Opcode::ConditionalSelect32, Value{cond}, a, b);
}
U64 IREmitter::ConditionalSelect(Cond cond, const U64& a, const U64& b) {
return Inst<U64>(Opcode::ConditionalSelect64, Value{cond}, a, b);
}
U32U64 IREmitter::ConditionalSelect(Cond cond, const U32U64& a, const U32U64& b) {
ASSERT(a.GetType() == b.GetType());
if (a.GetType() == Type::U32) {
return Inst<U32>(Opcode::ConditionalSelect32, Value{cond}, a, b);
} else {
return Inst<U64>(Opcode::ConditionalSelect64, Value{cond}, a, b);
}
}
NZCV IREmitter::NZCVFrom(const Value& value) {
return Inst<NZCV>(Opcode::GetNZCVFromOp, value);
}