[PATCH] D158742: [RISCV] Detect bitcasted splat patterns

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 07:49:02 PDT 2023


luke created this revision.
luke added reviewers: craig.topper, reames, frasercrmck.
Herald added subscribers: jobnoorman, asb, sunshaoce, pmatos, VincentWu, vkmr, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
luke requested review of this revision.
Herald added subscribers: llvm-commits, wangpc, eopXD, MaskRay.
Herald added a project: LLVM.

A common issue in RV32 is that i64 splats of fixed length vectors are legalized
to (bitcast v2i64 (build_vector <i32 x, i32 y, i32 x, i32 y>)).

These are then lowered in RISCVISelLowering to something like:

(insert_subvector (bitcast (extract_subvector (vmv_v_x_vl))))

RV64 doesn't have this problem since the insert_subvector and extract_subvector pairs are usually combined away, but the bitcast introduced with SEW=64 on RV32 prevents this from happening.

This patch handles the case by peeking through the inserts, bitcasts and
extracts to detect the "hidden" splats.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158742

Files:
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-cttz.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fshr-fshl-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-splat.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-load-int.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-store-int.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vadd-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vrol.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vror.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158742.553133.patch
Type: text/x-patch
Size: 196705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230824/0d13c7e5/attachment-0001.bin>


More information about the llvm-commits mailing list