[PATCH] D151719: Add special case for (select_cc 0, x, setlt, 0.0, 1.0) to lowerSELECT

Liao Chunyu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 08:29:34 PDT 2023


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

Use sint_to_fp instead of select. 
Reduce the number of branch instructions and 
avoid generating TargetConstantPool for double.

(select (setcc x, 1, setlt), 1.0, 0.0) -> (sint_to_fp (zext (setcc x, 1, setlt)))
https://alive2.llvm.org/ce/z/TYMMSD
https://godbolt.org/z/n543Y9v3e

(select (setcc x, 0, setgt), 0.0, 1.0) -> (sint_to_fp (zext (setcc x, 1, setlt)))
https://alive2.llvm.org/ce/z/L32zaJ
https://godbolt.org/z/GG4jWTPKK


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151719

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/double-select-icmp.ll
  llvm/test/CodeGen/RISCV/float-select-icmp.ll
  llvm/test/CodeGen/RISCV/half-select-icmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151719.526639.patch
Type: text/x-patch
Size: 7480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230530/fbe3475e/attachment.bin>


More information about the llvm-commits mailing list