[PATCH] D78190: Add Bfloat IR type

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 10:57:06 PDT 2020


craig.topper added a comment.

Is this missing support in SelectionDAG's type system? MachineValueType.h and ValueType.h or is that coming in another patch?



================
Comment at: llvm/docs/LangRef.rst:2896
+   * - ``bfloat``
+     - 16-bit brain floating-point value (10-bit mantissa)
+
----------------
bfloat doesn't have 10-bits of mantissa. its 1 bit of sign, 8-bits of exponent and 7-bits of mantissa.


================
Comment at: llvm/lib/Support/APFloat.cpp:4837
 
 APFloat APFloat::getAllOnesValue(unsigned BitWidth, bool isIEEE) {
   if (isIEEE) {
----------------
This is a bit of strange interace. I wonder if it wouldn't be possible to have the callers pass the semantics instead of the bitwidth and then this function could get the bitwidth from the semantics. It looks like there aren't many callers. I believe the one in Constants.cpp could get the semantics from getFltSemantics on the Type. Probably similar could be done at other callers?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78190





More information about the llvm-commits mailing list