This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] define isExtractSubvectorCheap
ClosedPublic

Authored by sebpop on Mar 1 2018, 2:29 PM.

Details

Summary

Following the ARM-neon backend, define isExtractSubvectorCheap to return true
when extracting low and high part of a neon register.

The patch disables a test in llvm/test/CodeGen/AArch64/arm64-ext.ll that was
checking that ReconstructShuffle in ISelLowering is working as expected. The
pattern to exercise ReconstructShuffle is a BUILD_VECTOR and the expected
pattern gets transformed earlier by the DAGCombiner into an extract_subvector +
vector_shuffle. As there is no way to disable the combiner to only exercise the
code in ISelLowering, the patch disables the testcase.

Diff Detail

Repository
rL LLVM

Event Timeline

sebpop created this revision.Mar 1 2018, 2:29 PM

It LGTM, but I'd wait a while to give a chance for others to chime up.

llvm/test/CodeGen/AArch64/arm64-ext.ll
100 ↗(On Diff #136604)

Methinks that this test could stay. Before, it resulted in a mix of EXT, UZP1, ZIP1. With this patch, in a pair of LDR, TBL, which seems to be a good result. Better yet, were the shuffle index changed to <i32 4, i32 8, i32 5, i32 9>, then the result would be just like in the test below.

sebpop added inline comments.Mar 5 2018, 12:46 PM
llvm/test/CodeGen/AArch64/arm64-ext.ll
100 ↗(On Diff #136604)

If I replace the pattern with <4,8,5,9> that is trivially matched as a ZIP1 pattern before and after the patch.
The testcase was crafted this way to force the compiler to use VEXT instructions instead of loads and stores on the stack.

As I tried to explain the the commit message, this testcase is fragile in the sense that it requires a BUILD_VECTOR to "survive" all DAG transforms until ISelLowering. The testcase is supposed to check that AArch64TargetLowering::ReconstructShuffle() works, and for that we need a BUILD_VECTOR in ISelLowering. As we now transform the BUILD_VECTOR earlier into an VEXT + vector_shuffle, we don't have the BUILD_VECTOR pattern when we get to ISelLowering.

javed.absar added inline comments.Mar 6 2018, 1:13 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
8176 ↗(On Diff #136604)

This is similar (identical, in fact, as far as i can see) to whats done in A32. LGTM.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 6 2018, 8:57 AM
This revision was automatically updated to reflect the committed changes.