[llvm] AMDGPU: Make v2f64 -> v2f16 conversion Legal only when unsafe fast math is set (PR #134738)

Changpeng Fang via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 14:37:02 PDT 2025


changpeng wrote:

> > Should not further spread use of the global options. FP casts have fast math flags, make use of those. Note this needs to be in custom lowering, legality cannot be use context dependent
> 
> I understand your proposal to avoid use of global options. But here we need to be consistent. Options.UnsafeFPMath has been used in all other places to expand/lower f64->f16. We should not use a different approach only here.

Or do you prefer a combination of fast math flag and global option, like this?
const SDNodeFlags Flags = Op->getFlags();
  bool AllowInaccurateFP_ROUND =
      Flags.hasApproximateFuncs() || DAG.getTarget().Options.UnsafeFPMath;


https://github.com/llvm/llvm-project/pull/134738


More information about the llvm-commits mailing list