-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[AArch64] recognize the shufflevector equivalent of a vector select #28904
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
Comments
*** Bug llvm/llvm-bugzilla-archive#29125 has been marked as a duplicate of this bug. *** |
Another possibility that was in bug 29125 - use inserts (this was an example with constants, but the 'ins' will be the same for a variable operand)? 2 inserts: |
The patch for canonicalization of vector select with constant condition to shuffle is here: |
Can this be closed Sanjay? |
I filed this as a courtesy to AArch64 (unfortunately for me, I don't currently have an incentive to optimize that backend), so if you're ok with this:
...then we can close this. But wouldn't this be better as:
Or some other permute ops? |
Sorry, that doesn't work. Is 'bsl' as shown in the description better? |
Or 2 of these: ? |
Ah sorry, I'd only skimmed the bug and thought a fix had already been committed. Looks like we still have work to do here, thanks for reporting. |
mentioned in issue llvm/llvm-bugzilla-archive#29125 |
reproducer: https://godbolt.org/z/E1dhe61Ea Codegen for shufflevector looks better now, using inserts:
don't think we can do any better than this. Although for the select it seems canonicalization isn't happening:
not sure what's going wrong there. Running inst-combine on its own we get identical IR so canonicalization (to shufflevector) is happening there: https://godbolt.org/z/xjf6WhrdP |
Argh, I realise my mistake now. Inst combine is happening but it's a middle-end pass and not run by llc! 🤦 So the select is canonicalized to a shuffle and the code-generation for the shuffle looks good, so this one can be closed. |
Extended Description
I'm guessing that one of these is generally better than the other (and there may be a better way than either of these?):
Note that in http://reviews.llvm.org/D22114 , there's a proposal to canonicalize to the shufflevector form of the IR.
The text was updated successfully, but these errors were encountered: