[PATCH] D134354: [AMDGPU][GlobalISel] Support mad/fma_mix selection
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 27 03:55:06 PDT 2022
foad 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);
----------------
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 :(
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