[PATCH] D111976: [DAG] Create fptosi.sat from clamped fptosi

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 08:51:36 PDT 2021


dmgreen added inline comments.


================
Comment at: llvm/test/CodeGen/X86/fpclamptosat.ll:1179
 entry:
   %conv = fptosi half %x to i128
   %spec.store.select = call i128 @llvm.smin.i128(i128 %conv, i128 9223372036854775807)
----------------
RKSimon wrote:
> Should we be taking into account the maximum/minimum representable value of the half type as well here?
Yeah I haven't looked into that at much yet. A fp16 only produces 17 (IIRC) bits of data, so anything larger than that doesn't really make much sense to try and saturate. I kept the test to keep the tests consistent and make sure nothing silly happened.  I wasn't sure if that was best optimized at the llvm level (maybe with some range analysis) or in DAG, but it felt like a different issue that I didn't try and address here.

Do you think it's worth doing something special with that here? Or removing the tests that don't make a huge amount of sense? Or leaving it as-is?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111976/new/

https://reviews.llvm.org/D111976



More information about the llvm-commits mailing list