[llvm] [SelectionDAG] Add support for the 3-way comparison intrinsics [US]CMP (PR #91871)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 1 03:25:48 PDT 2024
================
@@ -4426,6 +4511,56 @@ SDValue DAGTypeLegalizer::WidenVecRes_Binary(SDNode *N) {
{InOp1, InOp2, Mask, N->getOperand(3)}, N->getFlags());
}
+SDValue DAGTypeLegalizer::WidenVecRes_CMP(SDNode *N) {
+ LLVMContext &Ctxt = *DAG.getContext();
+ SDLoc dl(N);
+
+ SDValue LHS = N->getOperand(0);
+ SDValue RHS = N->getOperand(1);
+ EVT OpVT = LHS.getValueType();
+ EVT TransformedOpVT = TLI.getTypeToTransformTo(Ctxt, OpVT);
+ if (TransformedOpVT.isVector() &&
+ TransformedOpVT.getVectorNumElements() > OpVT.getVectorNumElements()) {
+ LHS = GetWidenedVector(LHS);
+ RHS = GetWidenedVector(RHS);
+ }
+
+ EVT WidenResVT = TLI.getTypeToTransformTo(Ctxt, N->getValueType(0));
+ ElementCount WidenResEC = WidenResVT.getVectorElementCount();
+ EVT WidenResElementVT = WidenResVT.getVectorElementType();
+
+ // At this point we know that the type of operands should be legal,
----------------
nikic wrote:
This doesn't sound right. The result types are legalized first, so we don't know at this point that the operands are legal.
https://github.com/llvm/llvm-project/pull/91871
More information about the llvm-commits
mailing list