IR: Implement Vector{Max,Min}{Signed,Unsigned}

This commit is contained in:
MerryMage 2018-02-13 17:56:46 +00:00
parent adb7f5f86f
commit 47c0ad0fc8
4 changed files with 195 additions and 0 deletions

View file

@ -932,6 +932,66 @@ U128 IREmitter::VectorLogicalShiftRight(size_t esize, const U128& a, u8 shift_am
return {};
}
U128 IREmitter::VectorMaxSigned(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:
return Inst<U128>(Opcode::VectorMaxS8, a, b);
case 16:
return Inst<U128>(Opcode::VectorMaxS16, a, b);
case 32:
return Inst<U128>(Opcode::VectorMaxS32, a, b);
case 64:
return Inst<U128>(Opcode::VectorMaxS64, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::VectorMaxUnsigned(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:
return Inst<U128>(Opcode::VectorMaxU8, a, b);
case 16:
return Inst<U128>(Opcode::VectorMaxU16, a, b);
case 32:
return Inst<U128>(Opcode::VectorMaxU32, a, b);
case 64:
return Inst<U128>(Opcode::VectorMaxU64, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::VectorMinSigned(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:
return Inst<U128>(Opcode::VectorMinS8, a, b);
case 16:
return Inst<U128>(Opcode::VectorMinS16, a, b);
case 32:
return Inst<U128>(Opcode::VectorMinS32, a, b);
case 64:
return Inst<U128>(Opcode::VectorMinS64, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::VectorMinUnsigned(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:
return Inst<U128>(Opcode::VectorMinU8, a, b);
case 16:
return Inst<U128>(Opcode::VectorMinU16, a, b);
case 32:
return Inst<U128>(Opcode::VectorMinU32, a, b);
case 64:
return Inst<U128>(Opcode::VectorMinU64, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::VectorMultiply(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:

View file

@ -219,6 +219,10 @@ public:
U128 VectorInterleaveLower(size_t esize, const U128& a, const U128& b);
U128 VectorLogicalShiftLeft(size_t esize, const U128& a, u8 shift_amount);
U128 VectorLogicalShiftRight(size_t esize, const U128& a, u8 shift_amount);
U128 VectorMaxSigned(size_t esize, const U128& a, const U128& b);
U128 VectorMaxUnsigned(size_t esize, const U128& a, const U128& b);
U128 VectorMinSigned(size_t esize, const U128& a, const U128& b);
U128 VectorMinUnsigned(size_t esize, const U128& a, const U128& b);
U128 VectorMultiply(size_t esize, const U128& a, const U128& b);
U128 VectorNarrow(size_t original_esize, const U128& a);
U128 VectorNot(const U128& a);

View file

@ -242,6 +242,22 @@ OPCODE(VectorLogicalShiftRight8, T::U128, T::U128, T::U8
OPCODE(VectorLogicalShiftRight16, T::U128, T::U128, T::U8 )
OPCODE(VectorLogicalShiftRight32, T::U128, T::U128, T::U8 )
OPCODE(VectorLogicalShiftRight64, T::U128, T::U128, T::U8 )
OPCODE(VectorMaxS8, T::U128, T::U128, T::U128 )
OPCODE(VectorMaxS16, T::U128, T::U128, T::U128 )
OPCODE(VectorMaxS32, T::U128, T::U128, T::U128 )
OPCODE(VectorMaxS64, T::U128, T::U128, T::U128 )
OPCODE(VectorMaxU8, T::U128, T::U128, T::U128 )
OPCODE(VectorMaxU16, T::U128, T::U128, T::U128 )
OPCODE(VectorMaxU32, T::U128, T::U128, T::U128 )
OPCODE(VectorMaxU64, T::U128, T::U128, T::U128 )
OPCODE(VectorMinS8, T::U128, T::U128, T::U128 )
OPCODE(VectorMinS16, T::U128, T::U128, T::U128 )
OPCODE(VectorMinS32, T::U128, T::U128, T::U128 )
OPCODE(VectorMinS64, T::U128, T::U128, T::U128 )
OPCODE(VectorMinU8, T::U128, T::U128, T::U128 )
OPCODE(VectorMinU16, T::U128, T::U128, T::U128 )
OPCODE(VectorMinU32, T::U128, T::U128, T::U128 )
OPCODE(VectorMinU64, T::U128, T::U128, T::U128 )
OPCODE(VectorMultiply8, T::U128, T::U128, T::U128 )
OPCODE(VectorMultiply16, T::U128, T::U128, T::U128 )
OPCODE(VectorMultiply32, T::U128, T::U128, T::U128 )