[SVE][CodeGen] Legalisation of INSERT_VECTOR_ELT for scalable vectors
authorKerry McLaughlin <kerry.mclaughlin@arm.com>
Tue, 11 Aug 2020 11:19:42 +0000 (12:19 +0100)
committerKerry McLaughlin <kerry.mclaughlin@arm.com>
Tue, 11 Aug 2020 11:57:28 +0000 (12:57 +0100)
commit455ed56d48e365f7d095254109abed876dc10c65
tree45d3c3d15b8c2b25c3a15b4cd45f438ab68811ec
parent49193e1fe7e143555d3b740610d6d1d20a553b2f
[SVE][CodeGen] Legalisation of INSERT_VECTOR_ELT for scalable vectors

When the result type of insertelement needs to be split,
SplitVecRes_INSERT_VECTOR_ELT will try to store the vector to a
stack temporary, store the element at the location of the stack
temporary plus the index, and reload the Lo/Hi parts.

This patch does the following to ensure this works for scalable vectors:
 - Sets the StackID with getStackIDForScalableVectors() in CreateStackTemporary
 - Adds an IsScalable flag to getMemBasePlusOffset() and scales the
    offset by VScale when this is true
 - Ensures the immediate is clamped correctly by clampDynamicVectorIndex
    so that we don't try to use an out of range index

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D84874
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/AArch64/sve-split-insert-elt.ll [new file with mode: 0644]