mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-08 15:38:19 +01:00
IR: Add microinstructions UnsignedSaturation and SignedSaturation
This commit is contained in:
parent
b1df70578f
commit
6a269a6ebd
4 changed files with 93 additions and 0 deletions
|
|
@ -348,6 +348,20 @@ IREmitter::ResultAndOverflow IREmitter::SignedSaturatedSub(const Value& a, const
|
|||
return {result, overflow};
|
||||
}
|
||||
|
||||
IREmitter::ResultAndOverflow IREmitter::UnsignedSaturation(const Value& a, size_t bit_size_to_saturate_to) {
|
||||
ASSERT(bit_size_to_saturate_to <= 31);
|
||||
auto result = Inst(Opcode::UnsignedSaturation, {a, Imm8(static_cast<u8>(bit_size_to_saturate_to))});
|
||||
auto overflow = Inst(Opcode::GetOverflowFromOp, {result});
|
||||
return {result, overflow};
|
||||
}
|
||||
|
||||
IREmitter::ResultAndOverflow IREmitter::SignedSaturation(const Value& a, size_t bit_size_to_saturate_to) {
|
||||
ASSERT(bit_size_to_saturate_to >= 1 && bit_size_to_saturate_to <= 32);
|
||||
auto result = Inst(Opcode::SignedSaturation, {a, Imm8(static_cast<u8>(bit_size_to_saturate_to))});
|
||||
auto overflow = Inst(Opcode::GetOverflowFromOp, {result});
|
||||
return {result, overflow};
|
||||
}
|
||||
|
||||
IREmitter::ResultAndGE IREmitter::PackedAddU8(const Value& a, const Value& b) {
|
||||
auto result = Inst(Opcode::PackedAddU8, {a, b});
|
||||
auto ge = Inst(Opcode::GetGEFromOp, {result});
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ public:
|
|||
|
||||
ResultAndOverflow SignedSaturatedAdd(const Value& a, const Value& b);
|
||||
ResultAndOverflow SignedSaturatedSub(const Value& a, const Value& b);
|
||||
ResultAndOverflow UnsignedSaturation(const Value& a, size_t bit_size_to_saturate_to);
|
||||
ResultAndOverflow SignedSaturation(const Value& a, size_t bit_size_to_saturate_to);
|
||||
|
||||
ResultAndGE PackedAddU8(const Value& a, const Value& b);
|
||||
ResultAndGE PackedAddS8(const Value& a, const Value& b);
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ OPCODE(NegateHighWord, T::U32, T::U32
|
|||
// Saturated instructions
|
||||
OPCODE(SignedSaturatedAdd, T::U32, T::U32, T::U32 )
|
||||
OPCODE(SignedSaturatedSub, T::U32, T::U32, T::U32 )
|
||||
OPCODE(UnsignedSaturation, T::U32, T::U32, T::U8 )
|
||||
OPCODE(SignedSaturation, T::U32, T::U32, T::U8 )
|
||||
|
||||
// Packed instructions
|
||||
OPCODE(PackedAddU8, T::U32, T::U32, T::U32 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue