Move decoding of insertps back to avoid unused warnings in x86 isel lowering, and fix movlhps/movhlps to decode 4 elements shuffles

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112869 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/AsmPrinter/X86InstComments.cpp b/lib/Target/X86/AsmPrinter/X86InstComments.cpp
index fa1e50b..61f5065 100644
--- a/lib/Target/X86/AsmPrinter/X86InstComments.cpp
+++ b/lib/Target/X86/AsmPrinter/X86InstComments.cpp
@@ -20,6 +20,34 @@
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
+//  Vector Mask Decoding for non-shuffles
+//===----------------------------------------------------------------------===//
+
+static void DecodeINSERTPSMask(unsigned Imm,
+                               SmallVectorImpl<unsigned> &ShuffleMask) {
+  // Defaults the copying the dest value.
+  ShuffleMask.push_back(0);
+  ShuffleMask.push_back(1);
+  ShuffleMask.push_back(2);
+  ShuffleMask.push_back(3);
+
+  // Decode the immediate.
+  unsigned ZMask = Imm & 15;
+  unsigned CountD = (Imm >> 4) & 3;
+  unsigned CountS = (Imm >> 6) & 3;
+
+  // CountS selects which input element to use.
+  unsigned InVal = 4+CountS;
+  // CountD specifies which element of destination to update.
+  ShuffleMask[CountD] = InVal;
+  // ZMask zaps values, potentially overriding the CountD elt.
+  if (ZMask & 1) ShuffleMask[0] = SM_SentinelZero;
+  if (ZMask & 2) ShuffleMask[1] = SM_SentinelZero;
+  if (ZMask & 4) ShuffleMask[2] = SM_SentinelZero;
+  if (ZMask & 8) ShuffleMask[3] = SM_SentinelZero;
+}
+
+//===----------------------------------------------------------------------===//
 // Top Level Entrypoint
 //===----------------------------------------------------------------------===//
 
@@ -42,13 +70,13 @@
   case X86::MOVLHPSrr:
     Src2Name = getRegName(MI->getOperand(2).getReg());
     Src1Name = getRegName(MI->getOperand(0).getReg());
-    DecodeMOVLHPSMask(ShuffleMask);
+    DecodeMOVLHPSMask(2, ShuffleMask);
     break;
 
   case X86::MOVHLPSrr:
     Src2Name = getRegName(MI->getOperand(2).getReg());
     Src1Name = getRegName(MI->getOperand(0).getReg());
-    DecodeMOVHLPSMask(ShuffleMask);
+    DecodeMOVHLPSMask(2, ShuffleMask);
     break;
 
   case X86::PSHUFDri: