[PATCH] D148523: [LegalizeTypes][VP] Widen fixed length vectors to VP nodes

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 06:12:05 PDT 2023


luke created this revision.
luke added reviewers: fakepaper56, craig.topper, frasercrmck, reames.
Herald added subscribers: asb, pmatos, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
Herald added a project: All.
luke requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999, pcwang-thead, MaskRay.
Herald added a project: LLVM.

If we have a node with an illegal fixed length vector result type that
needs widened, e.g. `x:v6i32 = add a, b`
Instead of just widening it to: `x:v8i32 = add a, b`
We can widen it to the equivalent VP operation and set the EVL to the
exact number of elements needed: `x:v8i32 = vp_add a, b, mask=true, evl=6`
Provided that the target supports the equivalent VP operation on the
widened type.

This patch applies this technique when widening unary, binary and
ternary ops, as well as selects, loads and stores, but there are more
places this could be applied.

For loads and stores, scalable vectors are already widened using VP ops,
so there the existing logic is just reused for fixed length vectors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148523

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-abs.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extract.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp2i.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-i2fp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-insert.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-interleaved-access.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-load.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-store.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vselect.ll
  llvm/test/CodeGen/VE/Vector/vec_add.ll
  llvm/test/CodeGen/VE/Vector/vec_and.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148523.514193.patch
Type: text/x-patch
Size: 163593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230417/72f15975/attachment.bin>


More information about the llvm-commits mailing list