summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/Utils
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-01-26 13:31:37 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-01-26 13:31:37 +0000
commit6a93596538cf7e49803721fd6b1603fd61588c2c (patch)
treeaa7992b8f9ba1c87a4bcacc1ae8770e08f065548 /llvm/lib/Target/X86/Utils
parent675911d99c2d10820775c58ff66aadc2de46da20 (diff)
downloadbcm5719-llvm-6a93596538cf7e49803721fd6b1603fd61588c2c.tar.gz
bcm5719-llvm-6a93596538cf7e49803721fd6b1603fd61588c2c.zip
X86: Decode PALIGN operands so I don't have to do it in my head.
llvm-svn: 173572
Diffstat (limited to 'llvm/lib/Target/X86/Utils')
-rw-r--r--llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp8
-rw-r--r--llvm/lib/Target/X86/Utils/X86ShuffleDecode.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp b/llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp
index 8b87c1f9c8a..9694808e641 100644
--- a/llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp
+++ b/llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp
@@ -61,6 +61,14 @@ void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask) {
ShuffleMask.push_back(NElts+i);
}
+void DecodePALIGNMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask) {
+ unsigned NumElts = VT.getVectorNumElements();
+ unsigned Offset = Imm * (VT.getVectorElementType().getSizeInBits() / 8);
+
+ for (unsigned i = 0; i != NumElts; ++i)
+ ShuffleMask.push_back((i + Offset) % (NumElts * 2));
+}
+
/// DecodePSHUFMask - This decodes the shuffle masks for pshufd, and vpermilp*.
/// VT indicates the type of the vector allowing it to handle different
/// datatypes and vector widths.
diff --git a/llvm/lib/Target/X86/Utils/X86ShuffleDecode.h b/llvm/lib/Target/X86/Utils/X86ShuffleDecode.h
index 70d8171a815..69ce4432ed1 100644
--- a/llvm/lib/Target/X86/Utils/X86ShuffleDecode.h
+++ b/llvm/lib/Target/X86/Utils/X86ShuffleDecode.h
@@ -35,6 +35,8 @@ void DecodeMOVHLPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
// <0,2> or <0,1,4,5>
void DecodeMOVLHPSMask(unsigned NElts, SmallVectorImpl<int> &ShuffleMask);
+void DecodePALIGNMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
+
void DecodePSHUFMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
void DecodePSHUFHWMask(MVT VT, unsigned Imm, SmallVectorImpl<int> &ShuffleMask);
OpenPOWER on IntegriCloud