ir: Add opcodes for performing vector absolute values

This commit is contained in:
Lioncash 2018-04-02 16:27:04 -04:00 committed by MerryMage
parent 84d49309b9
commit e33dcce14a
4 changed files with 86 additions and 0 deletions

View file

@ -789,6 +789,21 @@ U128 IREmitter::VectorSetElement(size_t esize, const U128& a, size_t index, cons
}
}
U128 IREmitter::VectorAbs(size_t esize, const U128& a) {
switch (esize) {
case 8:
return Inst<U128>(Opcode::VectorAbs8, a);
case 16:
return Inst<U128>(Opcode::VectorAbs16, a);
case 32:
return Inst<U128>(Opcode::VectorAbs32, a);
case 64:
return Inst<U128>(Opcode::VectorAbs64, a);
}
UNREACHABLE();
return {};
}
U128 IREmitter::VectorAdd(size_t esize, const U128& a, const U128& b) {
switch (esize) {
case 8:

View file

@ -208,6 +208,7 @@ public:
UAny VectorGetElement(size_t esize, const U128& a, size_t index);
U128 VectorSetElement(size_t esize, const U128& a, size_t index, const UAny& elem);
U128 VectorAbs(size_t esize, const U128& a);
U128 VectorAdd(size_t esize, const U128& a, const U128& b);
U128 VectorAnd(const U128& a, const U128& b);
U128 VectorArithmeticShiftRight(size_t esize, const U128& a, u8 shift_amount);

View file

@ -211,6 +211,10 @@ OPCODE(VectorSetElement8, T::U128, T::U128, T::U
OPCODE(VectorSetElement16, T::U128, T::U128, T::U8, T::U16 )
OPCODE(VectorSetElement32, T::U128, T::U128, T::U8, T::U32 )
OPCODE(VectorSetElement64, T::U128, T::U128, T::U8, T::U64 )
OPCODE(VectorAbs8, T::U128, T::U128 )
OPCODE(VectorAbs16, T::U128, T::U128 )
OPCODE(VectorAbs32, T::U128, T::U128 )
OPCODE(VectorAbs64, T::U128, T::U128 )
OPCODE(VectorAdd8, T::U128, T::U128, T::U128 )
OPCODE(VectorAdd16, T::U128, T::U128, T::U128 )
OPCODE(VectorAdd32, T::U128, T::U128, T::U128 )