[PATCH] D147668: [RFC][X86 isel] Remove lane requirement from lowerShuffleAsUNPCKAndPermute
Han Zhu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 22:47:12 PDT 2023
zhuhan0 added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:13559
+ size_t NumUndefs = 0;
+ SmallSet<int, 32> UniqueMask;
+ for (int Elt : Mask) {
----------------
RKSimon wrote:
> We can probably avoid the SmallSet by using std::optional?
> ```
> std::optional<int> UniqueElt;
> for (int Elt : Mask) {
> if (Elt == SM_SentinelUndef) {
> NumUndefs++;
> continue;
> }
> if (UniqueElt.has_value() && UniqueElt.value() != Elt)
> return false;
> UniqueElt = Elt;
> }
> return NumUndefs <= Mask.size() / 2 && UniqueElt.has_value();
> ```
> (untested)
Sweet. This works!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147668/new/
https://reviews.llvm.org/D147668
More information about the llvm-commits
mailing list