-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[RISCV][TTI] Add shuffle costing for masked slide lowering #128537
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
8b64212
01e60ff
8621324
81d57fc
210ca02
0c0a09a
d504717
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -413,6 +413,36 @@ bool llvm::getShuffleDemandedElts(int SrcWidth, ArrayRef<int> Mask, | |||||||||||||
| return true; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| bool llvm::isMaskedSlidePair(ArrayRef<int> Mask, int NumElts, | ||||||||||||||
|
Collaborator
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. Why did this need to move up to VectorUtils? Couldn't it stay in the RISCV backend?
Collaborator
Author
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 didn't see an obvious spot to put it. If you have a suggestion, happy to move it back. p.s. I'd meant to explicitly pose this question when posting the review, but apparently didn't. Oops. |
||||||||||||||
| std::pair<int, int> SrcInfo[2]) { | ||||||||||||||
| int SignalValue = NumElts * 2; | ||||||||||||||
preames marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
| SrcInfo[0] = {-1, SignalValue}; | ||||||||||||||
| SrcInfo[1] = {-1, SignalValue}; | ||||||||||||||
lukel97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| for (unsigned i = 0; i != Mask.size(); ++i) { | ||||||||||||||
preames marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||
| int M = Mask[i]; | ||||||||||||||
| if (M < 0) | ||||||||||||||
| continue; | ||||||||||||||
| int Src = M >= (int)NumElts; | ||||||||||||||
| int Diff = (int)i - (M % NumElts); | ||||||||||||||
| bool Match = false; | ||||||||||||||
| for (int j = 0; j < 2; j++) { | ||||||||||||||
preames marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| if (SrcInfo[j].first == -1) { | ||||||||||||||
| assert(SrcInfo[j].second == SignalValue); | ||||||||||||||
| SrcInfo[j].first = Src; | ||||||||||||||
| SrcInfo[j].second = Diff; | ||||||||||||||
| } | ||||||||||||||
| if (SrcInfo[j].first == Src && SrcInfo[j].second == Diff) { | ||||||||||||||
| Match = true; | ||||||||||||||
| break; | ||||||||||||||
| } | ||||||||||||||
|
||||||||||||||
| if (SrcInfo[j].first == Src && SrcInfo[j].second == Diff) { | |
| Match = true; | |
| break; | |
| } | |
| if (SrcInfo[j].first != Src || SrcInfo[j].second != Diff) | |
| 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.
This doesn't work. You need to walk multiple elements of the array, and exit only if none match.
Uh oh!
There was an error while loading. Please reload this page.