[PATCH] D152370: [Intrinsic] Introduce reduction intrinsics for minimum/maximum

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 14:14:52 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/ISDOpcodes.h:1294
   VECREDUCE_FMIN,
+  /// FMINIMUM/FMAXIMUM nodes support NaNs and signed zeroes compared to the
+  /// FMIN/FMAX variant above.
----------------
FMAX/FMIN support NaNs they just don't propagate them unless all inputs are NaN.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:12313
+  case ISD::FMAXIMUM: {
+    // Neutral element for fminnum/fminimum is NaN, Inf or FLT_MAX, depending on FMF.
     const fltSemantics &Semantics = EVTToAPFloatSemantics(VT);
----------------
The neutral element for FMINIMUM and FMAXIMUM shouldn't be NaN. That would turn the entire result into NaN.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152370/new/

https://reviews.llvm.org/D152370



More information about the llvm-commits mailing list