[PATCH] D107230: [RISCV] Support FP_TO_S/UINT_SAT for i32 and i64.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 31 12:46:24 PDT 2021


craig.topper created this revision.
craig.topper added reviewers: asb, frasercrmck, luismarques.
Herald added subscribers: StephenFan, vkmr, evandro, 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.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

The fcvt fp to integer instructions saturate if their input is
infinity or out of range, but the instructions produce a maximum
integer for nan instead of 0 required for the ISD opcodes.

This means we can use the instructions to do the saturating
conversion, but we'll need to fix up the nan case at the end.

We can probably improve the i8 and i16 default codegen as well,
but I'll leave that for a follow up.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107230

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/lib/Target/RISCV/RISCVInstrInfoD.td
  llvm/lib/Target/RISCV/RISCVInstrInfoF.td
  llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td
  llvm/test/CodeGen/RISCV/double-convert.ll
  llvm/test/CodeGen/RISCV/float-convert.ll
  llvm/test/CodeGen/RISCV/half-convert.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107230.363314.patch
Type: text/x-patch
Size: 33071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210731/9ee5dba8/attachment.bin>


More information about the llvm-commits mailing list