[llvm-commits] [llvm] r112869 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86InstComments.cpp X86ShuffleDecode.h
Bruno Cardoso Lopes
bruno.cardoso at gmail.com
Thu Sep 2 14:51:11 PDT 2010
Author: bruno
Date: Thu Sep 2 16:51:11 2010
New Revision: 112869
URL: http://llvm.org/viewvc/llvm-project?rev=112869&view=rev
Log:
Move decoding of insertps back to avoid unused warnings in x86 isel lowering, and fix movlhps/movhlps to decode 4 elements shuffles
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86InstComments.cpp
llvm/trunk/lib/Target/X86/X86ShuffleDecode.h
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86InstComments.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86InstComments.cpp?rev=112869&r1=112868&r2=112869&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86InstComments.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86InstComments.cpp Thu Sep 2 16:51:11 2010
@@ -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:
Modified: llvm/trunk/lib/Target/X86/X86ShuffleDecode.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ShuffleDecode.h?rev=112869&r1=112868&r2=112869&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ShuffleDecode.h (original)
+++ llvm/trunk/lib/Target/X86/X86ShuffleDecode.h Thu Sep 2 16:51:11 2010
@@ -26,38 +26,24 @@
SM_SentinelZero = ~0U
};
-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);
+// <3,1> or <6,7,2,3>
+static void DecodeMOVHLPSMask(unsigned NElts,
+ SmallVectorImpl<unsigned> &ShuffleMask) {
+ for (unsigned i = NElts/2; i != NElts; ++i)
+ ShuffleMask.push_back(NElts+i);
- // 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;
+ for (unsigned i = NElts/2; i != NElts; ++i)
+ ShuffleMask.push_back(i);
}
-static void DecodeMOVHLPSMask(SmallVectorImpl<unsigned> &ShuffleMask) {
- ShuffleMask.push_back(3);
- ShuffleMask.push_back(1);
-}
+// <0,2> or <0,1,4,5>
+static void DecodeMOVLHPSMask(unsigned NElts,
+ SmallVectorImpl<unsigned> &ShuffleMask) {
+ for (unsigned i = 0; i != NElts/2; ++i)
+ ShuffleMask.push_back(i);
-static void DecodeMOVLHPSMask(SmallVectorImpl<unsigned> &ShuffleMask) {
- ShuffleMask.push_back(0);
- ShuffleMask.push_back(2);
+ for (unsigned i = 0; i != NElts/2; ++i)
+ ShuffleMask.push_back(NElts+i);
}
static void DecodePSHUFMask(unsigned NElts, unsigned Imm,
More information about the llvm-commits
mailing list