-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[RISCV] Add patterns for fixed vector vwsll #87316
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 1 commit
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 |
---|---|---|
|
@@ -3287,22 +3287,25 @@ bool RISCVDAGToDAGISel::selectVSplatUimm(SDValue N, unsigned Bits, | |
} | ||
|
||
bool RISCVDAGToDAGISel::selectLow8BitsVSplat(SDValue N, SDValue &SplatVal) { | ||
// Truncates are custom lowered during legalization. | ||
auto IsTrunc = [this](SDValue N) { | ||
if (N->getOpcode() != RISCVISD::TRUNCATE_VECTOR_VL) | ||
auto IsVLNode = [this](SDValue N) { | ||
switch (N->getOpcode()) { | ||
case RISCVISD::TRUNCATE_VECTOR_VL: | ||
case RISCVISD::VSEXT_VL: | ||
case RISCVISD::VZEXT_VL: | ||
break; | ||
default: | ||
return false; | ||
} | ||
SDValue VL; | ||
selectVLOp(N->getOperand(2), VL); | ||
// Any vmset_vl is ok, since any bits past VL are undefined and we can | ||
// assume they are set. | ||
return N->getOperand(1).getOpcode() == RISCVISD::VMSET_VL && | ||
isa<ConstantSDNode>(VL) && | ||
cast<ConstantSDNode>(VL)->getSExtValue() == RISCV::VLMaxSentinel; | ||
// There's no passthru so any mask is ok, since any inactive elements will | ||
// be undef. | ||
return true; | ||
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. This return is unreachable |
||
}; | ||
|
||
// We can have multiple nested truncates, so unravel them all if needed. | ||
// We can have multiple nested nodes, so unravel them all if needed. | ||
while (N->getOpcode() == ISD::SIGN_EXTEND || | ||
N->getOpcode() == ISD::ZERO_EXTEND || IsTrunc(N)) { | ||
N->getOpcode() == ISD::ZERO_EXTEND || IsVLNode(N)) { | ||
if (!N.hasOneUse() || | ||
N.getValueType().getSizeInBits().getKnownMinValue() < 8) | ||
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. Not directly related to this patch, but what is this 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. Yes, that should definitely be 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. I've fixed it in this PR 785af38, let me know if I should split it off |
||
return false; | ||
|
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.
Do we still need to select VL is we aren't going to use VL?