[X86] Add support for printing shuffle comments for AVX512 PSHUFB instructions.
[oota-llvm.git] / lib / Target / X86 / Utils / X86ShuffleDecode.cpp
index 7b8527ef79d34235c1ed1ac2f29875a39e08734f..a3729769901f74c514db10305d003c3273ddbe4d 100644 (file)
@@ -309,9 +309,7 @@ void DecodePSHUFBMask(const Constant *C, SmallVectorImpl<int> &ShuffleMask) {
   //              i32 -2147483648, i32 -2147483648>
 
   unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
   //              i32 -2147483648, i32 -2147483648>
 
   unsigned MaskTySize = MaskTy->getPrimitiveSizeInBits();
-
-  if (MaskTySize != 128 && MaskTySize != 256) // FIXME: Add support for AVX-512.
-    return;
+  assert(MaskTySize == 128 || MaskTySize == 256 || MaskTySize == 512);
 
   // This is a straightforward byte vector.
   if (MaskTy->isVectorTy() && MaskTy->getVectorElementType()->isIntegerTy(8)) {
 
   // This is a straightforward byte vector.
   if (MaskTy->isVectorTy() && MaskTy->getVectorElementType()->isIntegerTy(8)) {
@@ -321,7 +319,7 @@ void DecodePSHUFBMask(const Constant *C, SmallVectorImpl<int> &ShuffleMask) {
     for (int i = 0; i < NumElements; ++i) {
       // For AVX vectors with 32 bytes the base of the shuffle is the 16-byte
       // lane of the vector we're inside.
     for (int i = 0; i < NumElements; ++i) {
       // For AVX vectors with 32 bytes the base of the shuffle is the 16-byte
       // lane of the vector we're inside.
-      int Base = i < 16 ? 0 : 16;
+      int Base = i & ~0xf;
       Constant *COp = C->getAggregateElement(i);
       if (!COp) {
         ShuffleMask.clear();
       Constant *COp = C->getAggregateElement(i);
       if (!COp) {
         ShuffleMask.clear();