aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/Utils
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2013-01-28 07:41:18 +0000
committerCraig Topper <craig.topper@gmail.com>2013-01-28 07:41:18 +0000
commit467016e58d57021b14f2ae562d221f00b07cb254 (patch)
tree8a2e7eef6908ad6a029e460d269771e67d98617f /lib/Target/X86/Utils
parent6ab4cbc98636eecafb12393463453b567d58e22c (diff)
downloadexternal_llvm-467016e58d57021b14f2ae562d221f00b07cb254.zip
external_llvm-467016e58d57021b14f2ae562d221f00b07cb254.tar.gz
external_llvm-467016e58d57021b14f2ae562d221f00b07cb254.tar.bz2
Fix 256-bit PALIGNR comment decoding to understand that it works on independent 256-bit lanes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/Utils')
-rw-r--r--lib/Target/X86/Utils/X86ShuffleDecode.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Target/X86/Utils/X86ShuffleDecode.cpp b/lib/Target/X86/Utils/X86ShuffleDecode.cpp
index b490f27..bbd4904 100644
--- a/lib/Target/X86/Utils/X86ShuffleDecode.cpp
+++ b/lib/Target/X86/Utils/X86ShuffleDecode.cpp
@@ -66,8 +66,17 @@ void DecodePALIGNRMask(MVT VT, unsigned Imm,
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));
+ unsigned NumLanes = VT.getSizeInBits() / 128;
+ unsigned NumLaneElts = NumElts / NumLanes;
+
+ for (unsigned l = 0; l != NumElts; l += NumLaneElts) {
+ for (unsigned i = 0; i != NumLaneElts; ++i) {
+ unsigned Base = i + Offset;
+ // if i+offset is out of this lane then we actually need the other source
+ if (Base >= NumLaneElts) Base += NumElts - NumLaneElts;
+ ShuffleMask.push_back(Base + l);
+ }
+ }
}
/// DecodePSHUFMask - This decodes the shuffle masks for pshufd, and vpermilp*.