[PATCH] D124269: [CostModel] Add basic fptoi_sat costs

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 09:01:20 PDT 2022


dmgreen created this revision.
dmgreen added reviewers: RKSimon, craig.topper, spatel, bjope.
Herald added subscribers: StephenFan, kristof.beyls.
Herald added a project: All.
dmgreen requested review of this revision.
Herald added a project: LLVM.

This adds some basic fptosi_sat and fptoui_sat target independent cost modelling. The fptosi_sat is modelled as a fmin/fmax to saturate the value, followed by a fp convert. The signed values then have an additional fcmp+select for handling Nan correctly.

The AArch64/Arm costs may be more incorrect, as the instruction exist natively. This can be fixed with target specific cost updates.


https://reviews.llvm.org/D124269

Files:
  llvm/include/llvm/CodeGen/BasicTTIImpl.h
  llvm/test/Analysis/CostModel/AArch64/fptoi_sat.ll
  llvm/test/Analysis/CostModel/ARM/fptoi_sat.ll
  llvm/test/Analysis/CostModel/X86/fptoi_sat.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124269.424487.patch
Type: text/x-patch
Size: 424559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220422/a00f118a/attachment-0001.bin>


More information about the llvm-commits mailing list