diff options
author | Craig Topper <craig.topper@gmail.com> | 2013-01-28 07:41:18 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2013-01-28 07:41:18 +0000 |
commit | 5c683972bc6c5bd29bd25891b9f54d73d47bce10 (patch) | |
tree | c5fe8657df5769411c85501c967ffd1d4618404b /llvm/lib/Target/X86/Utils | |
parent | 7b5773e9c771f5e922675c241570dc6ea2853abf (diff) | |
download | bcm5719-llvm-5c683972bc6c5bd29bd25891b9f54d73d47bce10.tar.gz bcm5719-llvm-5c683972bc6c5bd29bd25891b9f54d73d47bce10.zip |
Fix 256-bit PALIGNR comment decoding to understand that it works on independent 256-bit lanes.
llvm-svn: 173674
Diffstat (limited to 'llvm/lib/Target/X86/Utils')
-rw-r--r-- | llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp b/llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp index b490f270254..bbd490411f2 100644 --- a/llvm/lib/Target/X86/Utils/X86ShuffleDecode.cpp +++ b/llvm/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*. |