[llvm] [LoongArch][DAG] Custom lowering for vector SETCC operations (PR #177904)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 27 03:56:13 PST 2026
================
@@ -725,6 +727,38 @@ SDValue LoongArchTargetLowering::lowerConstantFP(SDValue Op,
return SDValue();
}
+SDValue LoongArchTargetLowering::lowerSETCC(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ EVT ResultVT = Op.getValueType();
+ EVT OperandVT = Op.getOperand(0).getValueType();
+
+ EVT SetCCResultVT =
+ getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), OperandVT);
+ // Check if the result type and operand type are already consistent
+ if (ResultVT == SetCCResultVT) {
+ return Op;
+ }
+
+ // Ensure operands have the same type
+ assert(Op.getOperand(0).getValueType() == Op.getOperand(1).getValueType() &&
+ "SETCC operands must have the same type!");
+
+ // Create the SETCC node with the result type derived from the operand type
+ SDValue SetCCNode =
+ DAG.getNode(ISD::SETCC, DL, SetCCResultVT, Op.getOperand(0),
+ Op.getOperand(1), Op.getOperand(2));
+
+ // Otherwise, extend or truncate the result to match the desired result type
+ if (ResultVT.bitsGT(SetCCResultVT)) {
+ SetCCNode = DAG.getNode(ISD::ANY_EXTEND, DL, ResultVT, SetCCNode);
----------------
woruyu wrote:
Done! modify to SIGN_EXTEND.
https://github.com/llvm/llvm-project/pull/177904
More information about the llvm-commits
mailing list