[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
Thu Jan 18 06:35:19 PST 2018
jonpa updated this revision to Diff 130402.
jonpa added a comment.
In https://reviews.llvm.org/D42100#978951, @efriedma wrote:
> > if there should be an assert that a EXTRACT_VECTOR_ELT should not implicitly truncate?
>
> There should be an assert, yes.
Where should this assert be located? Should it be asserted at the point of node creation, or just at the end during isel? I don't see any asserts in the getNode() method. (We could make this a separate patch, I guess)
>
>
>> I then had to narrow this handling to integer types, as I saw X86 failing with v4f80 vectors since TRUNCATE is only for integers.
>
>
>
> why are we triggering this path for v4f80? As long as the element size in bits is a multiple of 8, we can use separate stores for each element.
OK, I asked this previously since I was worried that if e.g. storing a v3i24, the i24 element stores might be promoted / split / ... somehow, so that it would be safest to just build the integer.
> (Whether the element size is a power of two isn't really important.)
So then we trust that the original loop in scalarizeVectorStore() will do the job, which seems to be the case.
I changed the check then to simply call isByteSized() on the vector element.
In case we get a floating point element which is not byte-sized, the assert for ISD::TRUNCATE will trigger. Since there are no such types in the language reference, I skipped that check.
Tests still pass unmodified from before.
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/avx512-mask-op.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
More information about the llvm-commits
mailing list