[PATCH] D153974: [RISCV] Don't include X1 in the X0_PD register pair

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 07:04:40 PDT 2023


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

This is perhaps more of a patch for initial discussion and suggestions for alternate approaches rather than ready for full review.

Zdinx on RV32 defines the D instructions as taking even register pairs, and specifies that if using X0 when as a destination then X1 won't be written, and if using X0 as a source then the value is still all 0s (i.e. X1 isn't read). Therefore, it's incorrect to model X0_PD as having X1 as a subregister. This will also be the case for register pairs in Zacas and the P extension (and this patch takes the same approach as D95588 <https://reviews.llvm.org/D95588> does).

This patch introduces a dummy register that is solely used as a subreg alongside X0 in X0_PD. I don't have a test change with this right now, beyond the confusing regalloc change in a seemingly unrelated test.


https://reviews.llvm.org/D153974

Files:
  llvm/lib/Target/RISCV/RISCVRegisterInfo.td
  llvm/test/CodeGen/RISCV/wide-scalar-shift-by-byte-multiple-legalization.ll
  llvm/test/CodeGen/RISCV/wide-scalar-shift-legalization.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153974.535383.patch
Type: text/x-patch
Size: 20542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230628/d311c91d/attachment.bin>


More information about the llvm-commits mailing list