[llvm] [SystemZ] Add custom handling of legal vectors with reduce-add. (PR #88495)
Dominik Steenken via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 05:57:22 PDT 2024
================
@@ -9505,3 +9514,39 @@ SDValue SystemZTargetLowering::lowerGET_ROUNDING(SDValue Op,
return DAG.getMergeValues({RetVal, Chain}, dl);
}
+
+SDValue SystemZTargetLowering::lowerVECREDUCE_ADD(SDValue Op,
+ SelectionDAG &DAG) const {
+ EVT VT = Op.getValueType();
+ Op = Op.getOperand(0);
+ EVT OpVT = Op.getValueType();
+
+ assert(OpVT.isVector() && "Operand type for VECREDUCE_ADD is not a vector.");
+
+ SDLoc DL(Op);
+
+ // load a 0 vector for the third operand of VSUM.
+ SDValue Zero = DAG.getSplatBuildVector(OpVT, DL, DAG.getConstant(0, DL, VT));
+
+ // execute VSUM.
+ switch (OpVT.getScalarSizeInBits()) {
+ case 8:
+ case 16:
+ Op = DAG.getNode(SystemZISD::VSUM, DL, MVT::v4i32, Op,
+ DAG.getBitcast(OpVT, Zero));
----------------
dominik-steenken wrote:
yes, for 8 and 16 bit scalars we do not need the bitcast. I will remove it.
https://github.com/llvm/llvm-project/pull/88495
More information about the llvm-commits
mailing list