[PATCH] D123377: [AArch64] Only mark cost 1 perfect shuffles as legal

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 03:39:47 PDT 2022


dmgreen created this revision.
dmgreen added reviewers: SjoerdMeijer, labrinea, samtebbs, jaykang10.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.

The perfect shuffle tables encode a cost of either 0 (a nop-copy) or 1 (a single instruction) with a cost encoding of 0 in the upper 2 bits. All perfect shuffles with any cost are then marked as legal shuffles though (the maximum encoded cost is 3), which can confuse the DAG combiner into thinking the shuffles are cheaper than the should be.

Limiting legal shuffles to single instructions seems to do better in most case, producing less instructions for complex shuffles. There are some cases that now become tbl, which may be better or worse depending on whether the instruction is in a loop and the tbl load can be hoisted out.


https://reviews.llvm.org/D123377

Files:
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/aarch64-wide-shuffle.ll
  llvm/test/CodeGen/AArch64/build-vector-extract.ll
  llvm/test/CodeGen/AArch64/insert-extend.ll
  llvm/test/CodeGen/AArch64/neon-reverseshuffle.ll
  llvm/test/CodeGen/AArch64/neon-widen-shuffle.ll
  llvm/test/CodeGen/AArch64/select-shuffle.ll
  llvm/test/CodeGen/AArch64/shuffles.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123377.421475.patch
Type: text/x-patch
Size: 69961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220408/d5e62173/attachment.bin>


More information about the llvm-commits mailing list