[PATCH] D128006: [RISCV] Avoid changing etype for splat of 0 or -1

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 13:48:19 PDT 2022


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

A splat of the values 0 and -1 as sign extended 12 bit immediates are always the same bit pattern regardless of the etype used to perform the operation.  As a result, we can sometimes avoid introducing a vsetvli just for the purposes of a splat.

Looking at the diffs, we don't get a huge amount of immediate value out of this.  We mostly push the vsetvli one instruction down, usually in front of a vmerge.  We also don't get the corresponding fixed length vector cases because VL typically is changed despite the actual bits written being the same.  Both of these are areas I plan to explore in future patches.

Interestingly, we need both the forward and backward implementation here to avoid practical regressions.  If we implement only the forward direction, we loose the ability to mutate a prior vsetvli and eliminate a later one entirely.  The duplication in this patch will disappear once we finish merging the demanded analysis code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128006

Files:
  llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
  llvm/test/CodeGen/RISCV/rvv/constant-folding-crash.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-calling-conv.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-extload-truncstore.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp-setcc.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp2i.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-unaligned.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128006.437693.patch
Type: text/x-patch
Size: 18919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220616/fc87bd5c/attachment-0001.bin>


More information about the llvm-commits mailing list