[llvm] [SystemZ] Add custom handling of legal vectors with reduce-add. (PR #88495)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 04:20:34 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));
----------------
uweigand wrote:
Doesn't Zero already have the correct type here, so we don't need the bitcast?
https://github.com/llvm/llvm-project/pull/88495
More information about the llvm-commits
mailing list