OSDN Git Service

[X86][XOP] Tidied up DecodeVPERMIL2PMask to more closely match DecodeVPERMILPMask.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 5 Jun 2016 14:33:43 +0000 (14:33 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 5 Jun 2016 14:33:43 +0000 (14:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271830 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ShuffleDecodeConstantPool.cpp

index abc05e4..f4a3461 100644 (file)
@@ -212,9 +212,11 @@ void DecodeVPERMIL2PMask(const Constant *C, unsigned M2Z, unsigned ElSize,
       continue;
     }
 
-    int Index = Selector & 0x3;
-    Index >>= (ElSize == 64 ? 1 : 0);
-    Index += (i / NumElementsPerLane) * NumElementsPerLane;
+    int Index = i & ~(NumElementsPerLane - 1);
+    if (ElSize == 64)
+      Index += (Selector >> 1) & 0x1;
+    else
+      Index += Selector & 0x3;
 
     int Src = (Selector >> 2) & 0x1;
     Index += Src * NumElements;