[PATCH] D105525: [GISel] Add fpext/fptrunc combines

Patrick Nappa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 24 16:09:06 PDT 2021


pnappa marked an inline comment as done.
pnappa added inline comments.


================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:476
+
+// Fold (fptrunc ([su]itofp x)) -> ([su]itofp x)
+def fptrunc_int_to_float: GICombineRule<
----------------
foad wrote:
> Is this safe? E.g. does converting i32->f32->f16 always give the same result as i32->f16, even though the former does a kind of double rounding (from 32 bits to 24 bit mantissa to 11 bit mantissa)? Does SelectionDAG do the equivalent optimization?
Re: correctness: https://alive2.llvm.org/ce/z/7xZjnH, https://alive2.llvm.org/ce/z/azpy9w. Yeah, it's sound.

I don't know if SDAG does the equivalent optimisation, I had a look in DAGCombiner.cpp, and can't see it. I don't have any experience with SDAG, unfortunately.


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

https://reviews.llvm.org/D105525



More information about the llvm-commits mailing list