[PATCH] D105206: [RISCV] Implement lround*/llround*/lrint*/llrint* with fcvt instruction with -fno-math-errno

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 09:44:46 PDT 2021


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

These are fp->int conversions using either RMM or dynamic rounding modes.

The lround and lrint opcodes have a return type of either i32 or
i64 depending on sizeof(long) in the frontend which should follow
xlen. llround/llrint should always return i64 so we'll need a libcall
for those on rv32.

The frontend will only emit the intrinsics if -fno-math-errno is in
effect otherwise a libcall will be emitted which will not use
these ISD opcodes.

gcc also does this optimization.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105206

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105206.355603.patch
Type: text/x-patch
Size: 19907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210630/e59fb262/attachment.bin>


More information about the llvm-commits mailing list