[AArch64] Match interleaved memory accesses into ldN/stN instructions.
authorHao Liu <Hao.Liu@arm.com>
Thu, 11 Jun 2015 09:05:02 +0000 (09:05 +0000)
committerHao Liu <Hao.Liu@arm.com>
Thu, 11 Jun 2015 09:05:02 +0000 (09:05 +0000)
commit442f620296b2a6d425dbd8b2da906488cf89efc2
treed8d5286fbb4cb101d5a7909a4d32856b5d85e191
parent3b8d35fb8d38022700dc565a26da4d24cf5e61c7
[AArch64] Match interleaved memory accesses into ldN/stN instructions.

Add a pass AArch64InterleavedAccess to identify and match interleaved memory accesses. This pass transforms an interleaved load/store into ldN/stN intrinsic. As Loop Vectorizor disables optimization on interleaved accesses by default, this optimization is also disabled by default. To enable it by "-aarch64-interleaved-access-opt=true"

E.g. Transform an interleaved load (Factor = 2):
       %wide.vec = load <8 x i32>, <8 x i32>* %ptr
       %v0 = shuffle %wide.vec, undef, <0, 2, 4, 6>  ; Extract even elements
       %v1 = shuffle %wide.vec, undef, <1, 3, 5, 7>  ; Extract odd elements
     Into:
       %ld2 = { <4 x i32>, <4 x i32> } call aarch64.neon.ld2(%ptr)
       %v0 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 0
       %v1 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 1

E.g. Transform an interleaved store (Factor = 2):
       %i.vec = shuffle %v0, %v1, <0, 4, 1, 5, 2, 6, 3, 7>  ; Interleaved vec
       store <8 x i32> %i.vec, <8 x i32>* %ptr
     Into:
       %v0 = shuffle %i.vec, undef, <0, 1, 2, 3>
       %v1 = shuffle %i.vec, undef, <4, 5, 6, 7>
       call void aarch64.neon.st2(%v0, %v1, %ptr)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239514 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64.h
lib/Target/AArch64/AArch64InterleavedAccess.cpp [new file with mode: 0644]
lib/Target/AArch64/AArch64TargetMachine.cpp
lib/Target/AArch64/AArch64TargetTransformInfo.cpp
lib/Target/AArch64/AArch64TargetTransformInfo.h
lib/Target/AArch64/CMakeLists.txt
lib/Transforms/Vectorize/LoopVectorize.cpp
test/CodeGen/AArch64/aarch64-interleaved-accesses.ll [new file with mode: 0644]