[PATCH] Lower certain build_vectors to insertps instructions
Filipe Cabecinhas
filcab+llvm.phabricator at gmail.com
Tue Apr 29 01:07:56 PDT 2014
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:5462
@@ +5461,3 @@
+ ElementMoveMask | (~NonZeros & 0xf));
+ return DAG.getNode(X86ISD::INSERTPS, dl, VT, V, V, InsertpsMask);
+ }
----------------
Elena Demikhovsky wrote:
> Let's assume that the first element of the BUILD_VECTOR is "undef" and the first element of EXTRACT does not go to any place. FirstNonZeroIdx = 2, for example. The INSERTPS instruction you use copies the first element to another place, because this instruction can manipulate with the first element only.
Hi Elena,
I'm not understanding what you mean, sorry.
I tried making examples from your comment, but they seem to work and do the correct modification.
When we find a non-zero element that has the correct index, we copy it to the same place, IF there's no element that has to change index (we use that index for countS and countD in the insertpsmask). If there is an element that changes index, then we use its old and new indices for the insertpsmask..
Here's a couple of examples:
ll file: https://gist.github.com/filcab/11392909
llc -debug output: https://gist.github.com/filcab/11392943
Thanks,
Filipe
http://reviews.llvm.org/D3521
More information about the llvm-commits
mailing list