mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 02:22:29 +00:00
Use vmladduhm to do v8i16 multiplies which is faster and simpler than doing
even/odd halves. Thanks to Nate telling me what's what. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27793 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1602,25 +1602,10 @@ static SDOperand LowerMUL(SDOperand Op, SelectionDAG &DAG) {
|
|||||||
} else if (Op.getValueType() == MVT::v8i16) {
|
} else if (Op.getValueType() == MVT::v8i16) {
|
||||||
SDOperand LHS = Op.getOperand(0), RHS = Op.getOperand(1);
|
SDOperand LHS = Op.getOperand(0), RHS = Op.getOperand(1);
|
||||||
|
|
||||||
// Multiply the even 16-bit parts, producing 32-bit sums.
|
SDOperand Zero = BuildSplatI(0, 1, MVT::v8i16, DAG);
|
||||||
SDOperand EvenParts = BuildIntrinsicOp(Intrinsic::ppc_altivec_vmuleuh,
|
|
||||||
LHS, RHS, DAG, MVT::v4i32);
|
|
||||||
EvenParts = DAG.getNode(ISD::BIT_CONVERT, MVT::v8i16, EvenParts);
|
|
||||||
|
|
||||||
// Multiply the odd 16-bit parts, producing 32-bit sums.
|
|
||||||
SDOperand OddParts = BuildIntrinsicOp(Intrinsic::ppc_altivec_vmulouh,
|
|
||||||
LHS, RHS, DAG, MVT::v4i32);
|
|
||||||
OddParts = DAG.getNode(ISD::BIT_CONVERT, MVT::v8i16, OddParts);
|
|
||||||
|
|
||||||
// Merge the results together.
|
return BuildIntrinsicOp(Intrinsic::ppc_altivec_vmladduhm,
|
||||||
std::vector<SDOperand> Ops;
|
LHS, RHS, Zero, DAG);
|
||||||
for (unsigned i = 0; i != 4; ++i) {
|
|
||||||
Ops.push_back(DAG.getConstant(2*i+1, MVT::i16));
|
|
||||||
Ops.push_back(DAG.getConstant(2*i+1+8, MVT::i16));
|
|
||||||
}
|
|
||||||
|
|
||||||
return DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v8i16, EvenParts, OddParts,
|
|
||||||
DAG.getNode(ISD::BUILD_VECTOR, MVT::v8i16, Ops));
|
|
||||||
} else if (Op.getValueType() == MVT::v16i8) {
|
} else if (Op.getValueType() == MVT::v16i8) {
|
||||||
SDOperand LHS = Op.getOperand(0), RHS = Op.getOperand(1);
|
SDOperand LHS = Op.getOperand(0), RHS = Op.getOperand(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user