[PATCH] Lower certain build_vectors to insertps instructions

Demikhovsky, Elena elena.demikhovsky at intel.com
Tue Apr 29 02:32:12 PDT 2014


Please ignore my last message. It's my mistake. I don't see any other problem in the code itself. I just think that such bunch of extracts and inserts may be converted to one shuffle.

-  Elena


-----Original Message-----
From: Filipe Cabecinhas [mailto:filcab+llvm.phabricator at gmail.com] 
Sent: Tuesday, April 29, 2014 11:08
To: filcab+llvm.phabricator at gmail.com; nrotem at apple.com; craig.topper at gmail.com; Demikhovsky, Elena
Cc: kakaka at akakaka.com; llvm-commits at cs.uiuc.edu
Subject: Re: [PATCH] Lower certain build_vectors to insertps instructions

================
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


---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the llvm-commits mailing list