[PATCH] D134354: [AMDGPU][GlobalISel] Support mad/fma_mix selection
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 28 08:29:38 PDT 2022
arsenm added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/Utils.cpp:665-667
+ return isKnownNeverNaN(DefMI->getOperand(1).getReg(), MRI, SNaN) &&
+ isKnownNeverNaN(DefMI->getOperand(2).getReg(), MRI, SNaN) &&
+ isKnownNeverNaN(DefMI->getOperand(3).getReg(), MRI, SNaN);
----------------
foad wrote:
> Pierre-vh wrote:
> > foad wrote:
> > > This isn't true. You can get a NaN result even if none of the inputs are NaNs, e.g. from +inf + -inf.
> > I just copied the SDag implementation so that one would be wrong too then
> > ```
> > case ISD::FMA:
> > case ISD::FMAD: {
> > if (SNaN)
> > return true;
> > return isKnownNeverNaN(Op.getOperand(0), SNaN, Depth + 1) &&
> > isKnownNeverNaN(Op.getOperand(1), SNaN, Depth + 1) &&
> > isKnownNeverNaN(Op.getOperand(2), SNaN, Depth + 1);
> > }
> > ```
> >
> > What is the alternative? Can this function not handle FMA/FMAD at all then?
> D50804 fixed the sdag implementation for fadd/fmul etc but apparently not for fma/fmad :(
Can you fix the DAG version? Plus this should be its own patch with its own testing
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134354/new/
https://reviews.llvm.org/D134354
More information about the llvm-commits
mailing list