-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[VP][RISCV] Introduce vp.splat and RISC-V. #98731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -777,6 +777,13 @@ END_REGISTER_VP(experimental_vp_reverse, EXPERIMENTAL_VP_REVERSE) | |
|
||
///// } Shuffles | ||
|
||
// llvm.vp.splat(ptr,val,mask,vlen) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
BEGIN_REGISTER_VP_INTRINSIC(experimental_vp_splat, 1, 2) | ||
BEGIN_REGISTER_VP_SDNODE(EXPERIMENTAL_VP_SPLAT, -1, experimental_vp_splat, 1, 2) | ||
VP_PROPERTY_NO_FUNCTIONAL | ||
HELPER_MAP_VPID_TO_VPSD(experimental_vp_splat, EXPERIMENTAL_VP_SPLAT) | ||
END_REGISTER_VP(experimental_vp_splat, EXPERIMENTAL_VP_SPLAT) | ||
|
||
#undef BEGIN_REGISTER_VP | ||
#undef BEGIN_REGISTER_VP_INTRINSIC | ||
#undef BEGIN_REGISTER_VP_SDNODE | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,7 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) { | |
break; | ||
case ISD::SPLAT_VECTOR: | ||
case ISD::SCALAR_TO_VECTOR: | ||
case ISD::EXPERIMENTAL_VP_SPLAT: | ||
Res = PromoteIntRes_ScalarOp(N); | ||
break; | ||
case ISD::STEP_VECTOR: Res = PromoteIntRes_STEP_VECTOR(N); break; | ||
|
@@ -1916,6 +1917,7 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) { | |
break; | ||
case ISD::SPLAT_VECTOR: | ||
case ISD::SCALAR_TO_VECTOR: | ||
case ISD::EXPERIMENTAL_VP_SPLAT: | ||
Res = PromoteIntOp_ScalarOp(N); | ||
break; | ||
case ISD::VSELECT: | ||
|
@@ -2211,10 +2213,14 @@ SDValue DAGTypeLegalizer::PromoteIntOp_INSERT_VECTOR_ELT(SDNode *N, | |
} | ||
|
||
SDValue DAGTypeLegalizer::PromoteIntOp_ScalarOp(SDNode *N) { | ||
SDValue Op = GetPromotedInteger(N->getOperand(0)); | ||
if (N->getOpcode() == ISD::EXPERIMENTAL_VP_SPLAT) | ||
return DAG.getNode(ISD::EXPERIMENTAL_VP_SPLAT, SDLoc(N), N->getValueType(0), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use UpdateNodeOperands? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
Op, N->getOperand(1), N->getOperand(2)); | ||
|
||
// Integer SPLAT_VECTOR/SCALAR_TO_VECTOR operands are implicitly truncated, | ||
// so just promote the operand in place. | ||
return SDValue(DAG.UpdateNodeOperands(N, | ||
GetPromotedInteger(N->getOperand(0))), 0); | ||
return SDValue(DAG.UpdateNodeOperands(N, Op), 0); | ||
} | ||
|
||
SDValue DAGTypeLegalizer::PromoteIntOp_SELECT(SDNode *N, unsigned OpNo) { | ||
|
@@ -5231,6 +5237,7 @@ bool DAGTypeLegalizer::ExpandIntegerOperand(SDNode *N, unsigned OpNo) { | |
case ISD::EXTRACT_ELEMENT: Res = ExpandOp_EXTRACT_ELEMENT(N); break; | ||
case ISD::INSERT_VECTOR_ELT: Res = ExpandOp_INSERT_VECTOR_ELT(N); break; | ||
case ISD::SCALAR_TO_VECTOR: Res = ExpandOp_SCALAR_TO_VECTOR(N); break; | ||
case ISD::EXPERIMENTAL_VP_SPLAT: | ||
case ISD::SPLAT_VECTOR: Res = ExpandIntOp_SPLAT_VECTOR(N); break; | ||
case ISD::SELECT_CC: Res = ExpandIntOp_SELECT_CC(N); break; | ||
case ISD::SETCC: Res = ExpandIntOp_SETCC(N); break; | ||
|
@@ -5859,7 +5866,11 @@ SDValue DAGTypeLegalizer::PromoteIntRes_ScalarOp(SDNode *N) { | |
EVT NOutElemVT = NOutVT.getVectorElementType(); | ||
|
||
SDValue Op = DAG.getNode(ISD::ANY_EXTEND, dl, NOutElemVT, N->getOperand(0)); | ||
|
||
if (N->isVPOpcode()) { | ||
SDValue Mask = N->getOperand(1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we pass N->getOperand(1) and N->getOperand(2) directly to getNode without the temporaries? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
SDValue VL = N->getOperand(2); | ||
return DAG.getNode(N->getOpcode(), dl, NOutVT, Op, Mask, VL); | ||
} | ||
return DAG.getNode(N->getOpcode(), dl, NOutVT, Op); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be something like
(double %scalar, <2 x i1> %mask, i32 %evl)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you for the finding.