A64: Implement SMLSL{2}

This commit is contained in:
Lioncash 2018-05-15 10:50:28 -04:00 committed by MerryMage
parent ada5c0b2fa
commit 3576c02d91
2 changed files with 14 additions and 1 deletions

View file

@ -685,7 +685,7 @@ INST(SABAL, "SABAL, SABAL2", "0Q001
INST(SUBHN, "SUBHN, SUBHN2", "0Q001110zz1mmmmm011000nnnnnddddd")
INST(SABDL, "SABDL, SABDL2", "0Q001110zz1mmmmm011100nnnnnddddd")
INST(SMLAL_vec, "SMLAL, SMLAL2 (vector)", "0Q001110zz1mmmmm100000nnnnnddddd")
//INST(SMLSL_vec, "SMLSL, SMLSL2 (vector)", "0Q001110zz1mmmmm101000nnnnnddddd")
INST(SMLSL_vec, "SMLSL, SMLSL2 (vector)", "0Q001110zz1mmmmm101000nnnnnddddd")
INST(SMULL_vec, "SMULL, SMULL2 (vector)", "0Q001110zz1mmmmm110000nnnnnddddd")
//INST(PMULL, "PMULL, PMULL2", "0Q001110zz1mmmmm111000nnnnnddddd")
INST(UADDL, "UADDL, UADDL2", "0Q101110zz1mmmmm000000nnnnnddddd")

View file

@ -39,6 +39,7 @@ void AbsoluteDifferenceLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, V
enum class MultiplyLongBehavior {
None,
Accumulate,
Subtract
};
void MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd,
@ -55,6 +56,9 @@ void MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec
if (behavior == MultiplyLongBehavior::Accumulate) {
const IR::U128 addend = v.V(doubled_datasize, Vd);
result = v.ir.VectorAdd(doubled_esize, addend, result);
} else if (behavior == MultiplyLongBehavior::Subtract) {
const IR::U128 minuend = v.V(doubled_datasize, Vd);
result = v.ir.VectorSub(doubled_esize, minuend, result);
}
v.V(doubled_datasize, Vd, result);
@ -120,6 +124,15 @@ bool TranslatorVisitor::SMLAL_vec(bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd) {
return true;
}
bool TranslatorVisitor::SMLSL_vec(bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd) {
if (size == 0b11) {
return ReservedValue();
}
MultiplyLong(*this, Q, size, Vm, Vn, Vd, MultiplyLongBehavior::Subtract);
return true;
}
bool TranslatorVisitor::SMULL_vec(bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec Vd) {
if (size == 0b11) {
return ReservedValue();