Skip to content

Commit a840bd2

Browse files
committed
Force vp.cttz.elts to be legalized in LegalizeDAG
1 parent aaa2af1 commit a840bd2

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,11 @@ void SelectionDAGLegalize::LegalizeOp(SDNode *Node) {
12201220
Action = TLI.getOperationAction(
12211221
Node->getOpcode(), Node->getOperand(1).getValueType());
12221222
break;
1223+
case ISD::VP_CTTZ_ELTS:
1224+
case ISD::VP_CTTZ_ELTS_ZERO_UNDEF:
1225+
Action = TLI.getOperationAction(Node->getOpcode(),
1226+
Node->getOperand(0).getValueType());
1227+
break;
12231228
default:
12241229
if (Node->getOpcode() >= ISD::BUILTIN_OP_END) {
12251230
Action = TLI.getCustomOperationAction(*Node);
@@ -4234,6 +4239,10 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
42344239
case ISD::VECREDUCE_FMINIMUM:
42354240
Results.push_back(TLI.expandVecReduce(Node, DAG));
42364241
break;
4242+
case ISD::VP_CTTZ_ELTS:
4243+
case ISD::VP_CTTZ_ELTS_ZERO_UNDEF:
4244+
Results.push_back(TLI.expandVPCTTZElements(Node, DAG));
4245+
break;
42374246
case ISD::GLOBAL_OFFSET_TABLE:
42384247
case ISD::GlobalAddress:
42394248
case ISD::GlobalTLSAddress:

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,13 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
510510
if (Action != TargetLowering::Legal) \
511511
break; \
512512
} \
513+
/* Defer non-vector results to LegalizeDAG. */ \
514+
/* Remove this after #90522 is landed */ \
515+
if (ISD::VPID == ISD::VP_CTTZ_ELTS || \
516+
ISD::VPID == ISD::VP_CTTZ_ELTS_ZERO_UNDEF) { \
517+
Action = TargetLowering::Legal; \
518+
break; \
519+
} \
513520
Action = TLI.getOperationAction(Node->getOpcode(), LegalizeVT); \
514521
} break;
515522
#include "llvm/IR/VPIntrinsics.def"
@@ -1026,13 +1033,6 @@ void VectorLegalizer::Expand(SDNode *Node, SmallVectorImpl<SDValue> &Results) {
10261033
return;
10271034
}
10281035
break;
1029-
case ISD::VP_CTTZ_ELTS:
1030-
case ISD::VP_CTTZ_ELTS_ZERO_UNDEF:
1031-
if (SDValue Expanded = TLI.expandVPCTTZElements(Node, DAG)) {
1032-
Results.push_back(Expanded);
1033-
return;
1034-
}
1035-
break;
10361036
case ISD::FSHL:
10371037
case ISD::VP_FSHL:
10381038
case ISD::FSHR:

0 commit comments

Comments
 (0)