[PATCH] D42100: Fix codegen of stores of vectors with non byte-sized elements.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 08:50:07 PST 2018


jonpa updated this revision to Diff 130631.
jonpa added a comment.

In https://reviews.llvm.org/D42100#980794, @efriedma wrote:

> > I don't see any asserts in the getNode() method.
>
> Really?  I see a bunch.  (getNode() is overloaded; make sure you're looking at the version for nodes with two operands.)  But anyway, that can be a separate patch.


Aah, sorry, now I see it. But actually, it says

  if (VT != Elt.getValueType())
     // If the vector element type is not legal, the BUILD_VECTOR operands
     // are promoted and implicitly truncated, and the result implicitly
     // extended. Make that explicit here.
     Elt = getAnyExtOrTrunc(Elt, DL, VT);

So it is not really true that there could be a general assert since this is actually even expected, or?  I don't think I have a patch for this, then.

> Specifically, the key here is that you can split without scalarizing if the size of each half in bits is a multiple of 8. So on AVX-512, we can split a <64 x i1> store into four legal <16 x i1> stores.

I updated the test in SplitVecOp_STORE to

+  // Scalarize if elements and the split halves are not byte-sized.
+  if (!MemoryVT.getScalarType().isByteSized() &&
+      (!LoMemVT.isByteSized() || !HiMemVT.isByteSized()))
+    return TLI.scalarizeVectorStore(N, DAG);

, which seems to work. Two stores will be produced, and the second store will have the byte-offset of the first store, which works as long as that first store is byte-sized.

Two X86 tests updated (test/CodeGen/X86/avx512-mask-op.ll, test/CodeGen/X86/vector-compare-results.ll)


https://reviews.llvm.org/D42100

Files:
  lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
  lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  test/CodeGen/Generic/store_nonbytesized_vecs.ll
  test/CodeGen/SystemZ/vec-move-17.ll
  test/CodeGen/X86/bitcast-and-setcc-512.ll
  test/CodeGen/X86/bitcast-setcc-512.ll
  test/CodeGen/X86/clear_upper_vector_element_bits.ll
  test/CodeGen/X86/pr20011.ll
  test/CodeGen/X86/trunc-store.ll
  test/CodeGen/X86/vector-compare-results.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42100.130631.patch
Type: text/x-patch
Size: 489496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180119/9f655bbf/attachment-0001.bin>


More information about the llvm-commits mailing list