[PATCH] D157204: [MLIR][Math] Add support for f16 in the expansion of math.roundeven

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 07:53:13 PDT 2023


alexander-shaposhnikov added inline comments.


================
Comment at: mlir/lib/Dialect/Math/Transforms/ExpandPatterns.cpp:321
+  unsigned mantissaWidth =
+      llvm::cast<FloatType>(operandETy).getFPMantissaWidth() - 1;
+  unsigned exponentWidth = bitWidth - mantissaWidth - 1;
----------------
qcolombet wrote:
> Why the `-1` here?
getFPMantissaWidth returns the width that takes into account the implicitly set bit,
see e.g. https://github.com/openxla/stablehlo/blob/a9ab84b453c26ecf179bd6e845ee8bbcc9f7cac0/stablehlo/reference/Element.cpp#L953 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157204



More information about the llvm-commits mailing list