[PATCH] D105525: [GISel] Add fpext/fptrunc combines
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 24 02:41:43 PDT 2021
foad added a comment.
> Removed the combine applying when unsafe math is enabled.
Thanks. Please remove it from the commit message too.
================
Comment at: llvm/include/llvm/Target/GlobalISel/Combine.td:476
+
+// Fold (fptrunc ([su]itofp x)) -> ([su]itofp x)
+def fptrunc_int_to_float: GICombineRule<
----------------
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?
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2467
+ unsigned SrcOpc = SrcMI->getOpcode();
+ if (SrcOpc == TargetOpcode::G_SITOFP || SrcOpc == TargetOpcode::G_UITOFP) {
+ Register SrcInputReg = SrcMI->getOperand(1).getReg();
----------------
Could return early here.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2490
+ LLT SrcInputTy = MRI.getType(SrcInputReg);
+ if (SrcInputTy.getSizeInBits() == 8) {
+ MatchInfo = [=](MachineIRBuilder &B) {
----------------
Could return early here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105525/new/
https://reviews.llvm.org/D105525
More information about the llvm-commits
mailing list