ir: Add opcodes for performing halving adds

This commit is contained in:
Lioncash 2018-05-04 08:22:14 -04:00 committed by MerryMage
parent 3d00dd63b4
commit 089096948a
4 changed files with 131 additions and 6 deletions

View file

@ -882,6 +882,32 @@ U128 IREmitter::VectorGreaterUnsigned(size_t esize, const U128& a, const U128& b
return VectorNot(VectorEqual(esize, VectorMinUnsigned(esize, a, b), a));
}
U128 IREmitter::VectorHalvingAddSigned(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:
return Inst<U128>(Opcode::VectorHalvingAddS8, a, b);
case 16:
return Inst<U128>(Opcode::VectorHalvingAddS16, a, b);
case 32:
return Inst<U128>(Opcode::VectorHalvingAddS32, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::VectorHalvingAddUnsigned(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:
return Inst<U128>(Opcode::VectorHalvingAddU8, a, b);
case 16:
return Inst<U128>(Opcode::VectorHalvingAddU16, a, b);
case 32:
return Inst<U128>(Opcode::VectorHalvingAddU32, a, b);
}
UNREACHABLE();
return {};
}
U128 IREmitter::VectorInterleaveLower(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:

View file

@ -206,6 +206,8 @@ public:
U128 VectorGreaterEqualUnsigned(size_t esize, const U128& a, const U128& b);
U128 VectorGreaterSigned(size_t esize, const U128& a, const U128& b);
U128 VectorGreaterUnsigned(size_t esize, const U128& a, const U128& b);
U128 VectorHalvingAddSigned(size_t esize, const U128& a, const U128& b);
U128 VectorHalvingAddUnsigned(size_t esize, const U128& a, const U128& b);
U128 VectorInterleaveLower(size_t esize, const U128& a, const U128& b);
U128 VectorInterleaveUpper(size_t esize, const U128& a, const U128& b);
U128 VectorLessEqualSigned(size_t esize, const U128& a, const U128& b);

View file

@ -251,6 +251,12 @@ OPCODE(VectorGreaterS8, T::U128, T::U128, T::U
OPCODE(VectorGreaterS16, T::U128, T::U128, T::U128 )
OPCODE(VectorGreaterS32, T::U128, T::U128, T::U128 )
OPCODE(VectorGreaterS64, T::U128, T::U128, T::U128 )
OPCODE(VectorHalvingAddS8, T::U128, T::U128, T::U128 )
OPCODE(VectorHalvingAddS16, T::U128, T::U128, T::U128 )
OPCODE(VectorHalvingAddS32, T::U128, T::U128, T::U128 )
OPCODE(VectorHalvingAddU8, T::U128, T::U128, T::U128 )
OPCODE(VectorHalvingAddU16, T::U128, T::U128, T::U128 )
OPCODE(VectorHalvingAddU32, T::U128, T::U128, T::U128 )
OPCODE(VectorInterleaveLower8, T::U128, T::U128, T::U128 )
OPCODE(VectorInterleaveLower16, T::U128, T::U128, T::U128 )
OPCODE(VectorInterleaveLower32, T::U128, T::U128, T::U128 )