[PATCH] D158053: [Legalizer] Expand fmaximum and fminimum
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 22 10:48:15 PDT 2023
tra added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:8161
+ *DAG.getContext(), APFloat::getNaN(DAG.EVTToAPFloatSemantics(VT)));
+ MinMax = DAG.getSelect(DL, VT, DAG.getSetCC(DL, CCVT, LHS, RHS, ISD::SETUO),
+ DAG.getConstantFP(*FPNaN, DL, VT), MinMax);
----------------
qiucf wrote:
> tra wrote:
> > Are we expected to return *a* NaN or the specific NaN value of one of the arguments?
> > APfloat's implementation returns one of the argument values.
> > X86ISelLowering.cpp does the same.
> >
> >
> Does the standard specify if the exact NaN should be returned? Choosing one NaN will produce more complex code.
I don't have access to the standard text. All I could find online are these notes https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/minNum_maxNum_Removal_Demotion_v3.pdf oulining the state of the min/max and the recommeendations for the standard changes. They do seem to care about NaN associativity/commutativity, but I have no idea what exactly ended up specified by the standard.
I assume that the authors of the implementations in APFloat and X86 did implement it according to the standard.
@tlively -- would you happen to know the details?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158053/new/
https://reviews.llvm.org/D158053
More information about the llvm-commits
mailing list