[PATCH] D138874: [InstCombine] canonicalize trunc + insert as bitcast + shuffle, part 3
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 1 00:57:32 PST 2022
dmgreen added a comment.
> We can create a select-shuffle for all targets because targets are expected to be able to lower select-shuffles reasonably.
A perhaps minor point, I don't (think) I have objections to the patch, but I always considered select-shuffles to be somewhat of an x86-ism. I believe there is a special set of instructions for handling them, where the mask is stored as part of the instruction. As far as I understand there usually isn't a truly generic way to lower them efficiently (I'd be interested if there was!), and at worst case needing to resort to either lane moves or a constant mask + and/or. If its only a single lane like all the tests then it would just be an extract+insert, which is simpler.
Generally I would consider shuffles to be complex operations that often have a fairly high cost. Insert and trunc and bitcast are all usually simple.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138874/new/
https://reviews.llvm.org/D138874
More information about the llvm-commits
mailing list