A64: Remove more instances of use of VectorMultiply64
This commit is contained in:
parent
082167feeb
commit
a179e2f2bb
2 changed files with 11 additions and 26 deletions
|
@ -55,21 +55,14 @@ bool MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Vec Vm, Vec Vn, Vec
|
||||||
const size_t datasize = 64;
|
const size_t datasize = 64;
|
||||||
const size_t doubled_datasize = datasize * 2;
|
const size_t doubled_datasize = datasize * 2;
|
||||||
|
|
||||||
const auto get_operands = [&] {
|
IR::U128 result = [&] {
|
||||||
const auto p1 = v.Vpart(datasize, Vn, Q);
|
const auto reg_n = v.Vpart(datasize, Vn, Q);
|
||||||
const auto p2 = v.Vpart(datasize, Vm, Q);
|
const auto reg_m = v.Vpart(datasize, Vm, Q);
|
||||||
|
|
||||||
if (sign == Signedness::Signed) {
|
return sign == Signedness::Signed
|
||||||
return std::make_pair(v.ir.VectorSignExtend(esize, p1),
|
? v.ir.VectorMultiplySignedWiden(esize, reg_n, reg_m)
|
||||||
v.ir.VectorSignExtend(esize, p2));
|
: v.ir.VectorMultiplyUnsignedWiden(esize, reg_n, reg_m);
|
||||||
}
|
}();
|
||||||
|
|
||||||
return std::make_pair(v.ir.VectorZeroExtend(esize, p1),
|
|
||||||
v.ir.VectorZeroExtend(esize, p2));
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto [operand1, operand2] = get_operands();
|
|
||||||
IR::U128 result = v.ir.VectorMultiply(doubled_esize, operand1, operand2);
|
|
||||||
|
|
||||||
if (behavior == MultiplyLongBehavior::Accumulate) {
|
if (behavior == MultiplyLongBehavior::Accumulate) {
|
||||||
const IR::U128 addend = v.V(doubled_datasize, Vd);
|
const IR::U128 addend = v.V(doubled_datasize, Vd);
|
||||||
|
|
|
@ -166,23 +166,15 @@ bool MultiplyLong(TranslatorVisitor& v, bool Q, Imm<2> size, Imm<1> L, Imm<1> M,
|
||||||
const size_t datasize = 64;
|
const size_t datasize = 64;
|
||||||
const auto [index, Vm] = Combine(size, H, L, M, Vmlo);
|
const auto [index, Vm] = Combine(size, H, L, M, Vmlo);
|
||||||
|
|
||||||
const auto extend_operands = [&](const IR::U128& lhs, const IR::U128& rhs) {
|
|
||||||
if (sign == Signedness::Signed) {
|
|
||||||
return std::make_pair(v.ir.VectorSignExtend(esize, lhs),
|
|
||||||
v.ir.VectorSignExtend(esize, rhs));
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_pair(v.ir.VectorZeroExtend(esize, lhs),
|
|
||||||
v.ir.VectorZeroExtend(esize, rhs));
|
|
||||||
};
|
|
||||||
|
|
||||||
const IR::U128 operand1 = v.Vpart(datasize, Vn, Q);
|
const IR::U128 operand1 = v.Vpart(datasize, Vn, Q);
|
||||||
const IR::U128 operand2 = v.V(idxsize, Vm);
|
const IR::U128 operand2 = v.V(idxsize, Vm);
|
||||||
const IR::U128 index_vector = v.ir.VectorBroadcastElement(esize, operand2, index);
|
const IR::U128 index_vector = v.ir.VectorBroadcastElement(esize, operand2, index);
|
||||||
|
|
||||||
const IR::U128 result = [&] {
|
const IR::U128 result = [&] {
|
||||||
const auto [extended_op1, extended_index] = extend_operands(operand1, index_vector);
|
const IR::U128 product = sign == Signedness::Signed
|
||||||
const IR::U128 product = v.ir.VectorMultiply(2 * esize, extended_op1, extended_index);
|
? v.ir.VectorMultiplySignedWiden(esize, operand1, index_vector)
|
||||||
|
: v.ir.VectorMultiplyUnsignedWiden(esize, operand1, index_vector);
|
||||||
|
|
||||||
if (extra_behavior == ExtraBehavior::None) {
|
if (extra_behavior == ExtraBehavior::None) {
|
||||||
return product;
|
return product;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue