[PATCH] [x86] Begin a significant overhaul of how vector lowering is done in the x86 backend.
Chandler Carruth
chandlerc at gmail.com
Wed Jun 25 18:20:23 PDT 2014
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:7005
@@ +7004,3 @@
+ //
+ // [0, 1, 2, 7, 4, 5, 6, 3] -PSHUFD[0,2,1,3]-> [0, 1, 4, 7, 2, 3, 6, 5]
+ //
----------------
Chandler Carruth wrote:
> Filipe Cabecinhas wrote:
> > This seems wrong. How can you have [{0,1}{2,7}{4,5}{6,3}] -> [{0,1}{4,7}{2,3}{6,5}]? How did the {2,7} get mixed with the {4,5}? Wouldn't pshufd just shuffle double words around but not break them?
> >
> > Shouldn't it become [{0,1}{4,5}{2,7}{6,3}]?
> Yea, this is why examples aren't clear.
>
> The PSHUFD applies to the *input* to this shuffle. The result here is the new mask needed after the pshufd to produce the same final output.
>
> How can i make this more clear?
Think I have a better way to illustrate it...
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:7013
@@ +7012,3 @@
+ std::accumulate(ThreeInputs.begin(), ThreeInputs.end(), 0)) /
+ 2;
+ int DWordB = OneInputHalfOffset / 2 + (OneInput / 2 + 1) % 2;
----------------
Filipe Cabecinhas wrote:
> Commenting how that subtraction gets us the index that's not used would be nice.
Yea, this is way down the clever rabbit hole.
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:7073
@@ +7072,3 @@
+ // a dword.
+ int AdjIndex = (InPlaceInputs[0] & ~1) + ((InPlaceInputs[0] + 1) % 2);
+ SourceHalfMask[AdjIndex - HalfOffset] = InPlaceInputs[1] - HalfOffset;
----------------
Filipe Cabecinhas wrote:
> Wouldn't InPlaceInputs[0] ^ 1 do the same thing? And it would be the same trick you used in the previous function.
Good idea. ;] I should be way more consistent with these tricks.
http://reviews.llvm.org/D4225
More information about the llvm-commits
mailing list