mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-04 13:44:31 +01:00
IR: Implement VectorSaturated{Signed,Unsigned}{Add,Sub}
This commit is contained in:
parent
3a50d444dc
commit
4e90754873
5 changed files with 471 additions and 0 deletions
|
|
@ -635,6 +635,83 @@ ResultAndOverflow<U32> IREmitter::UnsignedSaturation(const U32& a, size_t bit_si
|
|||
return {result, overflow};
|
||||
}
|
||||
|
||||
ResultAndOverflow<U128> IREmitter::VectorSignedSaturatedAdd(size_t esize, const U128& a, const U128& b) {
|
||||
const auto result = [&]{
|
||||
switch (esize) {
|
||||
case 8:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedAdd8, a, b);
|
||||
case 16:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedAdd16, a, b);
|
||||
case 32:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedAdd32, a, b);
|
||||
case 64:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedAdd64, a, b);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}();
|
||||
const auto overflow = Inst<U1>(Opcode::GetOverflowFromOp, result);
|
||||
return {result, overflow};
|
||||
}
|
||||
|
||||
ResultAndOverflow<U128> IREmitter::VectorSignedSaturatedSub(size_t esize, const U128& a, const U128& b) {
|
||||
const auto result = [&]{
|
||||
switch (esize) {
|
||||
case 8:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedSub8, a, b);
|
||||
case 16:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedSub16, a, b);
|
||||
case 32:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedSub32, a, b);
|
||||
case 64:
|
||||
return Inst<U128>(Opcode::VectorSignedSaturatedSub64, a, b);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}();
|
||||
const auto overflow = Inst<U1>(Opcode::GetOverflowFromOp, result);
|
||||
return {result, overflow};
|
||||
}
|
||||
|
||||
ResultAndOverflow<U128> IREmitter::VectorUnsignedSaturatedAdd(size_t esize, const U128& a, const U128& b) {
|
||||
const auto result = [&]{
|
||||
switch (esize) {
|
||||
case 8:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedAdd8, a, b);
|
||||
case 16:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedAdd16, a, b);
|
||||
case 32:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedAdd32, a, b);
|
||||
case 64:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedAdd64, a, b);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}();
|
||||
const auto overflow = Inst<U1>(Opcode::GetOverflowFromOp, result);
|
||||
return {result, overflow};
|
||||
}
|
||||
|
||||
ResultAndOverflow<U128> IREmitter::VectorUnsignedSaturatedSub(size_t esize, const U128& a, const U128& b) {
|
||||
const auto result = [&]{
|
||||
switch (esize) {
|
||||
case 8:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedSub8, a, b);
|
||||
case 16:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedSub16, a, b);
|
||||
case 32:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedSub32, a, b);
|
||||
case 64:
|
||||
return Inst<U128>(Opcode::VectorUnsignedSaturatedSub64, a, b);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}();
|
||||
const auto overflow = Inst<U1>(Opcode::GetOverflowFromOp, result);
|
||||
return {result, overflow};
|
||||
}
|
||||
|
||||
|
||||
ResultAndGE<U32> IREmitter::PackedAddU8(const U32& a, const U32& b) {
|
||||
const auto result = Inst<U32>(Opcode::PackedAddU8, a, b);
|
||||
const auto ge = Inst<U32>(Opcode::GetGEFromOp, result);
|
||||
|
|
|
|||
|
|
@ -166,6 +166,11 @@ public:
|
|||
ResultAndOverflow<UAny> UnsignedSaturatedSub(const UAny& a, const UAny& b);
|
||||
ResultAndOverflow<U32> UnsignedSaturation(const U32& a, size_t bit_size_to_saturate_to);
|
||||
|
||||
ResultAndOverflow<U128> VectorSignedSaturatedAdd(size_t esize, const U128& a, const U128& b);
|
||||
ResultAndOverflow<U128> VectorSignedSaturatedSub(size_t esize, const U128& a, const U128& b);
|
||||
ResultAndOverflow<U128> VectorUnsignedSaturatedAdd(size_t esize, const U128& a, const U128& b);
|
||||
ResultAndOverflow<U128> VectorUnsignedSaturatedSub(size_t esize, const U128& a, const U128& b);
|
||||
|
||||
ResultAndGE<U32> PackedAddU8(const U32& a, const U32& b);
|
||||
ResultAndGE<U32> PackedAddS8(const U32& a, const U32& b);
|
||||
ResultAndGE<U32> PackedAddU16(const U32& a, const U32& b);
|
||||
|
|
|
|||
|
|
@ -194,6 +194,24 @@ OPCODE(UnsignedSaturatedSub32, U32, U32,
|
|||
OPCODE(UnsignedSaturatedSub64, U64, U64, U64 )
|
||||
OPCODE(UnsignedSaturation, U32, U32, U8 )
|
||||
|
||||
// Vector saturated instructions
|
||||
OPCODE(VectorSignedSaturatedAdd8, U128, U128, U128 )
|
||||
OPCODE(VectorSignedSaturatedAdd16, U128, U128, U128 )
|
||||
OPCODE(VectorSignedSaturatedAdd32, U128, U128, U128 )
|
||||
OPCODE(VectorSignedSaturatedAdd64, U128, U128, U128 )
|
||||
OPCODE(VectorSignedSaturatedSub8, U128, U128, U128 )
|
||||
OPCODE(VectorSignedSaturatedSub16, U128, U128, U128 )
|
||||
OPCODE(VectorSignedSaturatedSub32, U128, U128, U128 )
|
||||
OPCODE(VectorSignedSaturatedSub64, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedAdd8, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedAdd16, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedAdd32, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedAdd64, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedSub8, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedSub16, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedSub32, U128, U128, U128 )
|
||||
OPCODE(VectorUnsignedSaturatedSub64, U128, U128, U128 )
|
||||
|
||||
// Packed instructions
|
||||
OPCODE(PackedAddU8, U32, U32, U32 )
|
||||
OPCODE(PackedAddS8, U32, U32, U32 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue