================
@@ -938,6 +960,171 @@ LLVM_ABI DoubleAPFloat scalbn(const DoubleAPFloat &Arg, 
int Exp,
                               roundingMode RM);
 LLVM_ABI DoubleAPFloat frexp(const DoubleAPFloat &X, int &Exp, roundingMode);
 
+class HexFloat final {
+  friend class HexFloatArith;
+
+  /// Note: this must be the first data member.
+  /// The semantics that this value obeys.
+  const fltSemantics *semantics;
+
+  /// A binary fraction with an explicit integer bit.
+  APInt significand;
+
+  /// The signed unbiased exponent of the value.
+  ExponentType exponent;
+
+  /// The exponent in the low-order part of a HexFloat 128.
+  /// This is ignored during computation, but must be preserved so that a
+  /// bitcast to APInt and back is an identity operation.
+  ExponentType low_exponent;
+
+  /// What kind of floating point number this is.
+  ///
+  /// Only 2 bits are required, but VisualStudio incorrectly sign extends it.
+  /// Using the extra bit keeps it from failing under VisualStudio.
+  fltCategory category : 3;
+
+  /// Sign bit of the number.
+  unsigned int sign : 1;
+
+  /// The sign bit in the low-order part of a HexFloat 128.
+  /// This is ignored; see comment for low_exponent.
+  unsigned int low_sign : 1;
+
+  void initialize(const fltSemantics *);
+  void assign(const HexFloat &);
+  void copySignificand(const HexFloat &);
+  void freeSignificand();
+
+  opStatus convertToSignExtendedInteger(MutableArrayRef<integerPart> Input,
+                                        unsigned int Width, bool IsSigned,
+                                        roundingMode RM, bool *IsExact) const;
+
+  static bool roundAwayFromZero(int sign, const APInt &fraction,
+                                roundingMode RM, lostFraction loast_fraction,
+                                int truncatedBits);
+
+public:
+  HexFloat(const fltSemantics &); // Default construct to +0.0
----------------
Ariel-Burton wrote:

The default constructor initializes to positive 0.

https://github.com/llvm/llvm-project/pull/179771
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to