[PATCH] D38756: [x86] use an insert op to put one variable element into a constant of vectors

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 14:15:28 PDT 2017


spatel updated this revision to Diff 118688.
spatel added a comment.

Patch updated:
Instead of creating a potentially illegal build vector of constants, create a legal vector of constants and explicitly load it for use in the insertelement.

I don't think we care about the potential regression in 'test_negative_zero_2' because that pattern would be simplified by instcombine; we're just making sure the negative zero constant is handled correctly.

Also, I think we're alright without checking for any particular vector ISA version. When we create the insertelement, if we don't have a particular insert op, that node will get expanded to something else, but that thing is still better than the chain of inserts that we currently produce. Example with only SSE2:

Legalizing: t21: v4i32 = insert_vector_elt t20, t2, Constant:i64<1>
Trying custom legalization
Could not custom legalize node
Trying to expand node
Creating new node: t22: v4i32 = scalar_to_vector t2
Succesfully expanded node
 ... replacing: t21: v4i32 = insert_vector_elt t20, t2, Constant:i64<1>

  with:      t23: v4i32 = vector_shuffle<0,4,2,3> t20, t22


https://reviews.llvm.org/D38756

Files:
  lib/Target/X86/X86ISelLowering.cpp
  test/CodeGen/X86/buildvec-insertvec.ll
  test/CodeGen/X86/insert-into-constant-vector.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38756.118688.patch
Type: text/x-patch
Size: 47655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171011/fa62af18/attachment.bin>


More information about the llvm-commits mailing list