[PATCH] D112428: [DAG] Create fptoui.sat from clamped fptosi

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 03:33:18 PDT 2021


dmgreen created this revision.
dmgreen added reviewers: spatel, RKSimon, craig.topper, tlively, efriedma, SjoerdMeijer.
Herald added subscribers: armkevincheng, jsmolens, eric-k256, frasercrmck, ecnelises, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, kristof.beyls, jgravelle-google, sbc100, dschuff.
Herald added a reviewer: sjarus.
dmgreen requested review of this revision.
Herald added subscribers: MaskRay, aheejin.
Herald added a project: LLVM.

As an extension to D111976 <https://reviews.llvm.org/D111976>, this converts clamp fptosi, clamped between 0 and (2^n)-1 to a fptoui.sat. This can greatly help on targets with conversions that naturally saturate, such as Arm.

X86 disables the transform as some of the test cases increases in size. A fptoui.sat necessitates a fp clamp without native support, so there is little use in converting if the instruction is just going to be expanded.


https://reviews.llvm.org/D112428

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/test/CodeGen/AArch64/fpclamptosat.ll
  llvm/test/CodeGen/AArch64/fpclamptosat_vec.ll
  llvm/test/CodeGen/ARM/fpclamptosat.ll
  llvm/test/CodeGen/RISCV/fpclamptosat.ll
  llvm/test/CodeGen/Thumb2/mve-fpclamptosat_vec.ll
  llvm/test/CodeGen/WebAssembly/fpclamptosat.ll
  llvm/test/CodeGen/WebAssembly/fpclamptosat_vec.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112428.381902.patch
Type: text/x-patch
Size: 67099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211025/b1fd8cdc/attachment.bin>


More information about the llvm-commits mailing list