[PATCH] D59096: [SelectionDAG][RISCV] Add a SELECT_PARTS SelectionDAG node

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 07:51:45 PST 2019


luismarques created this revision.
luismarques added reviewers: asb, apazos, efriedma, atanasyan, t.p.northover, SjoerdMeijer.
Herald added subscribers: llvm-commits, jdoerfert, jocewei, PkmX, jfb, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, kristof.beyls, arichardson, javed.absar, sdardis.
Herald added a project: LLVM.

The SELECT_PARTS node is especially useful for targets like RISC-V, ARM Thumb, 
MIPSR2, etc. that don't have a native conditional move instruction. In such 
targets SELECT is implemented using control flow. When you legalize a SELECT of 
double-word values you get two legal SELECTs. In those targets it's easy to end
up with nonoptimal control flow for conditionally moving both parts. Rather
than attempting to do a late stage optimization of that flow, you can lower
such SELECTs to SELECT_PARTS. The targets can then easily lower the
SELECT_PARTS to a pseudo-instruction that only branches once on the condition 
code. This patch also includes the RISC-V implementation of such a custom
lowering, and accompanying tests.


Repository:
  rL LLVM

https://reviews.llvm.org/D59096

Files:
  include/llvm/CodeGen/ISDOpcodes.h
  lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  lib/CodeGen/SelectionDAG/LegalizeTypes.h
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/Target/RISCV/RISCVISelLowering.cpp
  lib/Target/RISCV/RISCVISelLowering.h
  lib/Target/RISCV/RISCVInstrInfo.td
  test/CodeGen/RISCV/atomic-rmw.ll
  test/CodeGen/RISCV/select-parts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59096.189715.patch
Type: text/x-patch
Size: 108901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190307/f42fa1bd/attachment-0001.bin>


More information about the llvm-commits mailing list