aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit200b306f2006533a0e7a0ca75cb3103620e7aa84 (patch)
treebde1553da345534d456a9467af26108bfc110c0f /lib/Target/X86/Utils
parent126fde57f3bf8b9c1233cd434552fae4b296ca74 (diff)
downloadexternal_llvm-200b306f2006533a0e7a0ca75cb3103620e7aa84.zip
external_llvm-200b306f2006533a0e7a0ca75cb3103620e7aa84.tar.gz
external_llvm-200b306f2006533a0e7a0ca75cb3103620e7aa84.tar.bz2
X86: Decode PALIGN operands so I don't have to do it in my head.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/Utils')
-rw-r--r--lib/Target/X86/Utils/X86ShuffleDecode.cpp8
-rw-r--r--lib/Target/X86/Utils/X86ShuffleDecode.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/X86/Utils/X86ShuffleDecode.cpp b/lib/Target/X86/Utils/X86ShuffleDecode.cpp
index 8b87c1f..9694808 100644
--- a/lib/Target/X86/Utils/X86ShuffleDecode.cpp
+++ b/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/lib/Target/X86/Utils/X86ShuffleDecode.h b/lib/Target/X86/Utils/X86ShuffleDecode.h
index 70d8171..69ce443 100644
--- a/lib/Target/X86/Utils/X86ShuffleDecode.h
+++ b/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);