[PATCH] D78190: Add Bfloat IR type

Steve Canon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 16:20:21 PDT 2020


scanon requested changes to this revision.
scanon added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/docs/LangRef.rst:3240
+double are represented using the 16-digit form shown above (which matches the
+IEEE754 representation for double); half and float values must, however, be
+exactly representable as IEEE 754 half and single precision,
----------------
bfloat, half, and float


================
Comment at: llvm/docs/LangRef.rst:3241
+IEEE754 representation for double); half and float values must, however, be
+exactly representable as IEEE 754 half and single precision,
+respectively. Hexadecimal format is always used for long double, and there are
----------------
bfloat, IEEE 754 half, and IEEE 754 single precision


================
Comment at: llvm/docs/LangRef.rst:2896
+   * - ``bfloat``
+     - 16-bit brain floating-point value (8-bit mantissa)
+
----------------
bfloat and fp128 should agree w.r.t. whether or not the implicit bit counts. Either 7 and 112 or 8 and 113. Also, we should use "significand" instead of "mantissa". "Mantissa" has slipped in in a bunch of places, but "significand" is the IEEE 754 terminology, and we should follow it.


================
Comment at: llvm/include/llvm-c/Core.h:149
   LLVMHalfTypeKind,        /**< 16 bit floating point type */
+  LLVMBfloatTypeKind,      /**< 16 bit brain floating point type */
   LLVMFloatTypeKind,       /**< 32 bit floating point type */
----------------
Throughout this, I think `BFloat` would be more consistent with other types than `Bfloat` is.


================
Comment at: llvm/include/llvm/IR/Type.h:59
     HalfTyID,        ///<  1: 16-bit floating point type
-    FloatTyID,       ///<  2: 32-bit floating point type
-    DoubleTyID,      ///<  3: 64-bit floating point type
-    X86_FP80TyID,    ///<  4: 80-bit floating point type (X87)
-    FP128TyID,       ///<  5: 128-bit floating point type (112-bit mantissa)
-    PPC_FP128TyID,   ///<  6: 128-bit floating point type (two 64-bits, PowerPC)
-    LabelTyID,       ///<  7: Labels
-    MetadataTyID,    ///<  8: Metadata
-    X86_MMXTyID,     ///<  9: MMX vectors (64 bits, X86 specific)
-    TokenTyID,       ///< 10: Tokens
+    BfloatTyID,      ///<  2: 16-bit floating point type
+    FloatTyID,       ///<  3: 32-bit floating point type
----------------
Please add a parenthetical to disambiguate from HalfTyID, like the larger-than-double types have.


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