[llvm] [WIP][SelectionDAG] Add support for the 3-way comparison intrinsics [US]CMP (PR #91871)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 06:25:49 PDT 2024
================
@@ -1327,6 +1344,31 @@ void DAGTypeLegalizer::SplitVecRes_TernaryOp(SDNode *N, SDValue &Lo,
{Op0Hi, Op1Hi, Op2Hi, MaskHi, EVLHi}, Flags);
}
+void DAGTypeLegalizer::SplitVecRes_CMP(SDNode *N, SDValue &Lo, SDValue &Hi) {
+ LLVMContext &Ctxt = *DAG.getContext();
+ SDLoc dl(N);
+
+ SDValue LHS = N->getOperand(0);
+ SDValue RHS = N->getOperand(1);
+ EVT SplitOpVT = LHS.getValueType().getHalfNumVectorElementsVT(Ctxt);
+ EVT SplitResVT = N->getValueType(0).getHalfNumVectorElementsVT(Ctxt);
+
+ SDValue LHSLo = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, SplitOpVT, LHS,
+ DAG.getVectorIdxConstant(0, dl));
+ SDValue LHSHi = DAG.getNode(
+ ISD::EXTRACT_SUBVECTOR, dl, SplitOpVT, LHS,
+ DAG.getVectorIdxConstant(SplitOpVT.getVectorNumElements(), dl));
----------------
nikic wrote:
I think you're looking for `DAG.SplitVector()` here.
https://github.com/llvm/llvm-project/pull/91871
More information about the llvm-commits
mailing list