[PATCH] D10593: [X86][AVX] Add support for shuffle decoding of vperm2f128/vperm2i128 with zero'd lanes

Sanjay Patel spatel at rotateright.com
Mon Jul 6 09:44:43 PDT 2015


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:4456
@@ +4455,3 @@
+    // Mask only contains -ve index if an element is zero.
+    if (std::any_of(Mask.begin(), Mask.end(), [](int M){ return M < 0; }))
+      return false;
----------------
RKSimon wrote:
> spatel wrote:
> > Should this check be:
> >   M == SM_SentinelZero
> At the moment none of the functions that call getTargetShuffleMask support SM_SentinelZero, they treat any negative shuffle index value as UNDEF (hence the FIXME comment I added above) so we can't support this aspect of VPERM2X128 yet.
But in this function, we know that the mask values can only take on valid or SM_SentinelZero as values, right? So we can make this more specific:
    if (std::any_of(Mask.begin(), Mask.end(), [](int M){ return M == SM_SentinelZero; }))
      return false;

It won't change the result for the callers (they still just see the 'false' return value), but it makes the code explicitly match the preceding comment.


Repository:
  rL LLVM

http://reviews.llvm.org/D10593







More information about the llvm-commits mailing list