mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-07 15:08:22 +01:00
ir: Add opcodes for performing scalar integral min/max
This commit is contained in:
parent
7fdd8b0197
commit
2501bfbfae
4 changed files with 140 additions and 0 deletions
|
|
@ -449,6 +449,38 @@ U32U64 IREmitter::ExtractRegister(const U32U64& a, const U32U64& b, const U8& ls
|
|||
return Inst<U64>(Opcode::ExtractRegister64, a, b, lsb);
|
||||
}
|
||||
|
||||
U32U64 IREmitter::MaxSigned(const U32U64& a, const U32U64& b) {
|
||||
if (a.GetType() == IR::Type::U32) {
|
||||
return Inst<U32>(Opcode::MaxSigned32, a, b);
|
||||
}
|
||||
|
||||
return Inst<U64>(Opcode::MaxSigned64, a, b);
|
||||
}
|
||||
|
||||
U32U64 IREmitter::MaxUnsigned(const U32U64& a, const U32U64& b) {
|
||||
if (a.GetType() == IR::Type::U32) {
|
||||
return Inst<U32>(Opcode::MaxUnsigned32, a, b);
|
||||
}
|
||||
|
||||
return Inst<U64>(Opcode::MaxUnsigned64, a, b);
|
||||
}
|
||||
|
||||
U32U64 IREmitter::MinSigned(const U32U64& a, const U32U64& b) {
|
||||
if (a.GetType() == IR::Type::U32) {
|
||||
return Inst<U32>(Opcode::MinSigned32, a, b);
|
||||
}
|
||||
|
||||
return Inst<U64>(Opcode::MinSigned64, a, b);
|
||||
}
|
||||
|
||||
U32U64 IREmitter::MinUnsigned(const U32U64& a, const U32U64& b) {
|
||||
if (a.GetType() == IR::Type::U32) {
|
||||
return Inst<U32>(Opcode::MinUnsigned32, a, b);
|
||||
}
|
||||
|
||||
return Inst<U64>(Opcode::MinUnsigned64, a, b);
|
||||
}
|
||||
|
||||
ResultAndOverflow<U32> IREmitter::SignedSaturatedAdd(const U32& a, const U32& b) {
|
||||
auto result = Inst<U32>(Opcode::SignedSaturatedAdd, a, b);
|
||||
auto overflow = Inst<U1>(Opcode::GetOverflowFromOp, result);
|
||||
|
|
|
|||
|
|
@ -137,6 +137,10 @@ public:
|
|||
U64 ByteReverseDual(const U64& a);
|
||||
U32U64 CountLeadingZeros(const U32U64& a);
|
||||
U32U64 ExtractRegister(const U32U64& a, const U32U64& b, const U8& lsb);
|
||||
U32U64 MaxSigned(const U32U64& a, const U32U64& b);
|
||||
U32U64 MaxUnsigned(const U32U64& a, const U32U64& b);
|
||||
U32U64 MinSigned(const U32U64& a, const U32U64& b);
|
||||
U32U64 MinUnsigned(const U32U64& a, const U32U64& b);
|
||||
|
||||
ResultAndOverflow<U32> SignedSaturatedAdd(const U32& a, const U32& b);
|
||||
ResultAndOverflow<U32> SignedSaturatedSub(const U32& a, const U32& b);
|
||||
|
|
|
|||
|
|
@ -145,6 +145,14 @@ OPCODE(CountLeadingZeros32, T::U32, T::U32
|
|||
OPCODE(CountLeadingZeros64, T::U64, T::U64 )
|
||||
OPCODE(ExtractRegister32, T::U32, T::U32, T::U32, T::U8 )
|
||||
OPCODE(ExtractRegister64, T::U64, T::U64, T::U64, T::U8 )
|
||||
OPCODE(MaxSigned32, T::U32, T::U32, T::U32 )
|
||||
OPCODE(MaxSigned64, T::U64, T::U64, T::U64 )
|
||||
OPCODE(MaxUnsigned32, T::U32, T::U32, T::U32 )
|
||||
OPCODE(MaxUnsigned64, T::U64, T::U64, T::U64 )
|
||||
OPCODE(MinSigned32, T::U32, T::U32, T::U32 )
|
||||
OPCODE(MinSigned64, T::U64, T::U64, T::U64 )
|
||||
OPCODE(MinUnsigned32, T::U32, T::U32, T::U32 )
|
||||
OPCODE(MinUnsigned64, T::U64, T::U64, T::U64 )
|
||||
|
||||
// Saturated instructions
|
||||
OPCODE(SignedSaturatedAdd, T::U32, T::U32, T::U32 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue