LLVM  16.0.0git
APFixedPoint.h
Go to the documentation of this file.
1 //===- APFixedPoint.h - Fixed point constant handling -----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// Defines the fixed point number interface.
11 /// This is a class for abstracting various operations performed on fixed point
12 /// types.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_ADT_APFIXEDPOINT_H
17 #define LLVM_ADT_APFIXEDPOINT_H
18 
19 #include "llvm/ADT/APSInt.h"
20 #include "llvm/ADT/DenseMapInfo.h"
21 #include "llvm/ADT/SmallString.h"
23 
24 namespace llvm {
25 
26 class APFloat;
27 struct fltSemantics;
28 
29 /// The fixed point semantics work similarly to fltSemantics. The width
30 /// specifies the whole bit width of the underlying scaled integer (with padding
31 /// if any). The scale represents the number of fractional bits in this type.
32 /// When HasUnsignedPadding is true and this type is unsigned, the first bit
33 /// in the value this represents is treated as padding.
35 public:
36  static constexpr unsigned WidthBitWidth = 16;
37  static constexpr unsigned LsbWeightBitWidth = 13;
38  /// Used to differentiate between constructors with Width and Lsb from the
39  /// default Width and scale
40  struct Lsb {
41  int LsbWeight;
42  };
43  FixedPointSemantics(unsigned Width, unsigned Scale, bool IsSigned,
44  bool IsSaturated, bool HasUnsignedPadding)
45  : FixedPointSemantics(Width, Lsb{-static_cast<int>(Scale)}, IsSigned,
46  IsSaturated, HasUnsignedPadding) {}
47  FixedPointSemantics(unsigned Width, Lsb Weight, bool IsSigned,
48  bool IsSaturated, bool HasUnsignedPadding)
49  : Width(Width), LsbWeight(Weight.LsbWeight), IsSigned(IsSigned),
50  IsSaturated(IsSaturated), HasUnsignedPadding(HasUnsignedPadding) {
51  assert(isUInt<WidthBitWidth>(Width) && isInt<LsbWeightBitWidth>(Weight.LsbWeight));
52  assert(!(IsSigned && HasUnsignedPadding) &&
53  "Cannot have unsigned padding on a signed type.");
54  }
55 
56  /// Check if the Semantic follow the requirements of an older more limited
57  /// version of this class
58  bool isValidLegacySema() const {
59  return LsbWeight <= 0 && static_cast<int>(Width) >= -LsbWeight;
60  }
61  unsigned getWidth() const { return Width; }
62  unsigned getScale() const { assert(isValidLegacySema()); return -LsbWeight; }
63  int getLsbWeight() const { return LsbWeight; }
64  int getMsbWeight() const {
65  return LsbWeight + Width - 1 /*Both lsb and msb are both part of width*/;
66  }
67  bool isSigned() const { return IsSigned; }
68  bool isSaturated() const { return IsSaturated; }
69  bool hasUnsignedPadding() const { return HasUnsignedPadding; }
70 
71  void setSaturated(bool Saturated) { IsSaturated = Saturated; }
72 
73  /// return true if the first bit doesn't have a strictly positive weight
74  bool hasSignOrPaddingBit() const { return IsSigned || HasUnsignedPadding; }
75 
76  /// Return the number of integral bits represented by these semantics. These
77  /// are separate from the fractional bits and do not include the sign or
78  /// padding bit.
79  unsigned getIntegralBits() const {
80  return std::max(getMsbWeight() + 1 - hasSignOrPaddingBit(), 0);
81  }
82 
83  /// Return the FixedPointSemantics that allows for calculating the full
84  /// precision semantic that can precisely represent the precision and ranges
85  /// of both input values. This does not compute the resulting semantics for a
86  /// given binary operation.
88  getCommonSemantics(const FixedPointSemantics &Other) const;
89 
90  /// Print semantics for debug purposes
91  void print(llvm::raw_ostream& OS) const;
92 
93  /// Returns true if this fixed-point semantic with its value bits interpreted
94  /// as an integer can fit in the given floating point semantic without
95  /// overflowing to infinity.
96  /// For example, a signed 8-bit fixed-point semantic has a maximum and
97  /// minimum integer representation of 127 and -128, respectively. If both of
98  /// these values can be represented (possibly inexactly) in the floating
99  /// point semantic without overflowing, this returns true.
100  bool fitsInFloatSemantics(const fltSemantics &FloatSema) const;
101 
102  /// Return the FixedPointSemantics for an integer type.
104  bool IsSigned) {
105  return FixedPointSemantics(Width, /*Scale=*/0, IsSigned,
106  /*IsSaturated=*/false,
107  /*HasUnsignedPadding=*/false);
108  }
109 
110  bool operator==(FixedPointSemantics Other) const {
111  return Width == Other.Width && LsbWeight == Other.LsbWeight &&
112  IsSigned == Other.IsSigned && IsSaturated == Other.IsSaturated &&
113  HasUnsignedPadding == Other.HasUnsignedPadding;
114  }
115  bool operator!=(FixedPointSemantics Other) const { return !(*this == Other); }
116 
117 private:
118  unsigned Width : WidthBitWidth;
119  signed int LsbWeight : LsbWeightBitWidth;
120  unsigned IsSigned : 1;
121  unsigned IsSaturated : 1;
122  unsigned HasUnsignedPadding : 1;
123 };
124 
125 static_assert(sizeof(FixedPointSemantics) == 4, "");
126 
128  return hash_value(bit_cast<uint32_t>(Val));
129 }
130 
131 template <> struct DenseMapInfo<FixedPointSemantics> {
133  return FixedPointSemantics(0, 0, false, false, false);
134  }
135 
137  return FixedPointSemantics(0, 1, false, false, false);
138  }
139 
140  static unsigned getHashValue(const FixedPointSemantics &Val) {
141  return hash_value(Val);
142  }
143 
144  static bool isEqual(const char &LHS, const char &RHS) { return LHS == RHS; }
145 };
146 
147 /// The APFixedPoint class works similarly to APInt/APSInt in that it is a
148 /// functional replacement for a scaled integer. It supports a wide range of
149 /// semantics including the one used by fixed point types proposed in ISO/IEC
150 /// JTC1 SC22 WG14 N1169. The class carries the value and semantics of
151 /// a fixed point, and provides different operations that would normally be
152 /// performed on fixed point types.
154 public:
155  APFixedPoint(const APInt &Val, const FixedPointSemantics &Sema)
156  : Val(Val, !Sema.isSigned()), Sema(Sema) {
157  assert(Val.getBitWidth() == Sema.getWidth() &&
158  "The value should have a bit width that matches the Sema width");
159  }
160 
162  : APFixedPoint(APInt(Sema.getWidth(), Val, Sema.isSigned()), Sema) {}
163 
164  // Zero initialization.
165  APFixedPoint(const FixedPointSemantics &Sema) : APFixedPoint(0, Sema) {}
166 
167  APSInt getValue() const { return APSInt(Val, !Sema.isSigned()); }
168  inline unsigned getWidth() const { return Sema.getWidth(); }
169  inline unsigned getScale() const { return Sema.getScale(); }
170  int getLsbWeight() const { return Sema.getLsbWeight(); }
171  int getMsbWeight() const { return Sema.getMsbWeight(); }
172  inline bool isSaturated() const { return Sema.isSaturated(); }
173  inline bool isSigned() const { return Sema.isSigned(); }
174  inline bool hasPadding() const { return Sema.hasUnsignedPadding(); }
175  FixedPointSemantics getSemantics() const { return Sema; }
176 
177  bool getBoolValue() const { return Val.getBoolValue(); }
178 
179  // Convert this number to match the semantics provided. If the overflow
180  // parameter is provided, set this value to true or false to indicate if this
181  // operation results in an overflow.
183  bool *Overflow = nullptr) const;
184 
185  // Perform binary operations on a fixed point type. The resulting fixed point
186  // value will be in the common, full precision semantics that can represent
187  // the precision and ranges of both input values. See convert() for an
188  // explanation of the Overflow parameter.
189  APFixedPoint add(const APFixedPoint &Other, bool *Overflow = nullptr) const;
190  APFixedPoint sub(const APFixedPoint &Other, bool *Overflow = nullptr) const;
191  APFixedPoint mul(const APFixedPoint &Other, bool *Overflow = nullptr) const;
192  APFixedPoint div(const APFixedPoint &Other, bool *Overflow = nullptr) const;
193 
194  // Perform shift operations on a fixed point type. Unlike the other binary
195  // operations, the resulting fixed point value will be in the original
196  // semantic.
197  APFixedPoint shl(unsigned Amt, bool *Overflow = nullptr) const;
198  APFixedPoint shr(unsigned Amt, bool *Overflow = nullptr) const {
199  // Right shift cannot overflow.
200  if (Overflow)
201  *Overflow = false;
202  return APFixedPoint(Val >> Amt, Sema);
203  }
204 
205  /// Perform a unary negation (-X) on this fixed point type, taking into
206  /// account saturation if applicable.
207  APFixedPoint negate(bool *Overflow = nullptr) const;
208 
209  /// Return the integral part of this fixed point number, rounded towards
210  /// zero. (-2.5k -> -2)
211  APSInt getIntPart() const {
212  if (getMsbWeight() < 0)
213  return APSInt(APInt::getZero(getWidth()), Val.isUnsigned());
214  APSInt ExtVal =
215  (getLsbWeight() > 0) ? Val.extend(getWidth() + getLsbWeight()) : Val;
216  if (Val < 0 && Val != -Val) // Cover the case when we have the min val
217  return -((-ExtVal).relativeShl(getLsbWeight()));
218  return ExtVal.relativeShl(getLsbWeight());
219  }
220 
221  /// Return the integral part of this fixed point number, rounded towards
222  /// zero. The value is stored into an APSInt with the provided width and sign.
223  /// If the overflow parameter is provided, and the integral value is not able
224  /// to be fully stored in the provided width and sign, the overflow parameter
225  /// is set to true.
226  APSInt convertToInt(unsigned DstWidth, bool DstSign,
227  bool *Overflow = nullptr) const;
228 
229  /// Convert this fixed point number to a floating point value with the
230  /// provided semantics.
231  APFloat convertToFloat(const fltSemantics &FloatSema) const;
232 
233  void toString(SmallVectorImpl<char> &Str) const;
234  std::string toString() const {
236  toString(S);
237  return std::string(S.str());
238  }
239 
240  void print(raw_ostream &) const;
241  void dump() const;
242 
243  // If LHS > RHS, return 1. If LHS == RHS, return 0. If LHS < RHS, return -1.
244  int compare(const APFixedPoint &Other) const;
245  bool operator==(const APFixedPoint &Other) const {
246  return compare(Other) == 0;
247  }
248  bool operator!=(const APFixedPoint &Other) const {
249  return compare(Other) != 0;
250  }
251  bool operator>(const APFixedPoint &Other) const { return compare(Other) > 0; }
252  bool operator<(const APFixedPoint &Other) const { return compare(Other) < 0; }
253  bool operator>=(const APFixedPoint &Other) const {
254  return compare(Other) >= 0;
255  }
256  bool operator<=(const APFixedPoint &Other) const {
257  return compare(Other) <= 0;
258  }
259 
260  static APFixedPoint getMax(const FixedPointSemantics &Sema);
261  static APFixedPoint getMin(const FixedPointSemantics &Sema);
262 
263  /// Given a floating point semantic, return the next floating point semantic
264  /// with a larger exponent and larger or equal mantissa.
265  static const fltSemantics *promoteFloatSemantics(const fltSemantics *S);
266 
267  /// Create an APFixedPoint with a value equal to that of the provided integer,
268  /// and in the same semantics as the provided target semantics. If the value
269  /// is not able to fit in the specified fixed point semantics, and the
270  /// overflow parameter is provided, it is set to true.
272  const FixedPointSemantics &DstFXSema,
273  bool *Overflow = nullptr);
274 
275  /// Create an APFixedPoint with a value equal to that of the provided
276  /// floating point value, in the provided target semantics. If the value is
277  /// not able to fit in the specified fixed point semantics and the overflow
278  /// parameter is specified, it is set to true.
279  /// For NaN, the Overflow flag is always set. For +inf and -inf, if the
280  /// semantic is saturating, the value saturates. Otherwise, the Overflow flag
281  /// is set.
283  const FixedPointSemantics &DstFXSema,
284  bool *Overflow = nullptr);
285 
286 private:
287  APSInt Val;
288  FixedPointSemantics Sema;
289 };
290 
292  OS << FX.toString();
293  return OS;
294 }
295 
296 inline hash_code hash_value(const APFixedPoint &Val) {
297  return hash_combine(Val.getSemantics(), Val.getValue());
298 }
299 
300 template <> struct DenseMapInfo<APFixedPoint> {
301  static inline APFixedPoint getEmptyKey() {
303  }
304 
305  static inline APFixedPoint getTombstoneKey() {
307  }
308 
309  static unsigned getHashValue(const APFixedPoint &Val) {
310  return hash_value(Val);
311  }
312 
313  static bool isEqual(const APFixedPoint &LHS, const APFixedPoint &RHS) {
314  return LHS.getSemantics() == RHS.getSemantics() &&
315  LHS.getValue() == RHS.getValue();
316  }
317 };
318 
319 } // namespace llvm
320 
321 #endif
llvm::lltok::APFloat
@ APFloat
Definition: LLToken.h:459
llvm::APFixedPoint::getValue
APSInt getValue() const
Definition: APFixedPoint.h:167
llvm::APSInt::relativeShl
APSInt relativeShl(unsigned Amt) const
Definition: APSInt.h:205
llvm::DenseMapInfo< APFixedPoint >::getEmptyKey
static APFixedPoint getEmptyKey()
Definition: APFixedPoint.h:301
llvm::APFixedPoint::compare
int compare(const APFixedPoint &Other) const
Definition: APFixedPoint.cpp:73
llvm::APFixedPoint::getFromFloatValue
static APFixedPoint getFromFloatValue(const APFloat &Value, const FixedPointSemantics &DstFXSema, bool *Overflow=nullptr)
Create an APFixedPoint with a value equal to that of the provided floating point value,...
Definition: APFixedPoint.cpp:532
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::APFixedPoint
The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a s...
Definition: APFixedPoint.h:153
llvm::APFixedPoint::APFixedPoint
APFixedPoint(const FixedPointSemantics &Sema)
Definition: APFixedPoint.h:165
llvm::FixedPointSemantics::Lsb
Used to differentiate between constructors with Width and Lsb from the default Width and scale.
Definition: APFixedPoint.h:40
llvm::APFixedPoint::operator>
bool operator>(const APFixedPoint &Other) const
Definition: APFixedPoint.h:251
llvm::FixedPointSemantics::getScale
unsigned getScale() const
Definition: APFixedPoint.h:62
llvm::FixedPointSemantics::getIntegralBits
unsigned getIntegralBits() const
Return the number of integral bits represented by these semantics.
Definition: APFixedPoint.h:79
llvm::DenseMapInfo< APFixedPoint >::isEqual
static bool isEqual(const APFixedPoint &LHS, const APFixedPoint &RHS)
Definition: APFixedPoint.h:313
llvm::APFixedPoint::hasPadding
bool hasPadding() const
Definition: APFixedPoint.h:174
llvm::DenseMapInfo< FixedPointSemantics >::getEmptyKey
static FixedPointSemantics getEmptyKey()
Definition: APFixedPoint.h:132
llvm::APFixedPoint::isSaturated
bool isSaturated() const
Definition: APFixedPoint.h:172
llvm::APFixedPoint::print
void print(raw_ostream &) const
Definition: APFixedPoint.cpp:421
llvm::lltok::APSInt
@ APSInt
Definition: LLToken.h:460
llvm::APFixedPoint::operator!=
bool operator!=(const APFixedPoint &Other) const
Definition: APFixedPoint.h:248
llvm::APFixedPoint::negate
APFixedPoint negate(bool *Overflow=nullptr) const
Perform a unary negation (-X) on this fixed point type, taking into account saturation if applicable.
Definition: APFixedPoint.cpp:428
llvm::APInt::getBitWidth
unsigned getBitWidth() const
Return the number of bits in the APInt.
Definition: APInt.h:1431
llvm::APSInt::extend
APSInt extend(uint32_t width) const
Definition: APSInt.h:98
llvm::DenseMapInfo< FixedPointSemantics >::getTombstoneKey
static FixedPointSemantics getTombstoneKey()
Definition: APFixedPoint.h:136
llvm::FixedPointSemantics::LsbWeightBitWidth
static constexpr unsigned LsbWeightBitWidth
Definition: APFixedPoint.h:37
llvm::max
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:337
RHS
Value * RHS
Definition: X86PartialReduction.cpp:76
llvm::APFixedPoint::getIntPart
APSInt getIntPart() const
Return the integral part of this fixed point number, rounded towards zero.
Definition: APFixedPoint.h:211
llvm::FixedPointSemantics::getCommonSemantics
FixedPointSemantics getCommonSemantics(const FixedPointSemantics &Other) const
Return the FixedPointSemantics that allows for calculating the full precision semantic that can preci...
Definition: APFixedPoint.cpp:155
llvm::APInt::getZero
static APInt getZero(unsigned numBits)
Get the '0' value for the specified bit-width.
Definition: APInt.h:177
llvm::FixedPointSemantics::print
void print(llvm::raw_ostream &OS) const
Print semantics for debug purposes.
Definition: APFixedPoint.cpp:21
llvm::FixedPointSemantics::hasUnsignedPadding
bool hasUnsignedPadding() const
Definition: APFixedPoint.h:69
llvm::APFixedPoint::getLsbWeight
int getLsbWeight() const
Definition: APFixedPoint.h:170
LHS
Value * LHS
Definition: X86PartialReduction.cpp:75
llvm::DenseMapInfo
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition: APInt.h:34
llvm::FixedPointSemantics::setSaturated
void setSaturated(bool Saturated)
Definition: APFixedPoint.h:71
llvm::APFixedPoint::shr
APFixedPoint shr(unsigned Amt, bool *Overflow=nullptr) const
Definition: APFixedPoint.h:198
llvm::APFixedPoint::operator<=
bool operator<=(const APFixedPoint &Other) const
Definition: APFixedPoint.h:256
llvm::APFixedPoint::operator>=
bool operator>=(const APFixedPoint &Other) const
Definition: APFixedPoint.h:253
SmallString.h
llvm::FixedPointSemantics::FixedPointSemantics
FixedPointSemantics(unsigned Width, unsigned Scale, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding)
Definition: APFixedPoint.h:43
llvm::FixedPointSemantics::hasSignOrPaddingBit
bool hasSignOrPaddingBit() const
return true if the first bit doesn't have a strictly positive weight
Definition: APFixedPoint.h:74
llvm::APFixedPoint::isSigned
bool isSigned() const
Definition: APFixedPoint.h:173
llvm::APFixedPoint::APFixedPoint
APFixedPoint(uint64_t Val, const FixedPointSemantics &Sema)
Definition: APFixedPoint.h:161
llvm::APFixedPoint::getWidth
unsigned getWidth() const
Definition: APFixedPoint.h:168
llvm::FixedPointSemantics
The fixed point semantics work similarly to fltSemantics.
Definition: APFixedPoint.h:34
llvm::APFixedPoint::getMax
static APFixedPoint getMax(const FixedPointSemantics &Sema)
Definition: APFixedPoint.cpp:119
llvm::APSInt
An arbitrary precision integer that knows its signedness.
Definition: APSInt.h:23
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:291
llvm::APFixedPoint::getMin
static APFixedPoint getMin(const FixedPointSemantics &Sema)
Definition: APFixedPoint.cpp:127
llvm::FixedPointSemantics::isSaturated
bool isSaturated() const
Definition: APFixedPoint.h:68
llvm::APFixedPoint::operator<
bool operator<(const APFixedPoint &Other) const
Definition: APFixedPoint.h:252
llvm::APFixedPoint::getBoolValue
bool getBoolValue() const
Definition: APFixedPoint.h:177
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
llvm::DenseMapInfo< FixedPointSemantics >::isEqual
static bool isEqual(const char &LHS, const char &RHS)
Definition: APFixedPoint.h:144
llvm::FixedPointSemantics::isSigned
bool isSigned() const
Definition: APFixedPoint.h:67
llvm::FixedPointSemantics::getWidth
unsigned getWidth() const
Definition: APFixedPoint.h:61
llvm::APFloat
Definition: APFloat.h:716
llvm::FixedPointSemantics::Lsb::LsbWeight
int LsbWeight
Definition: APFixedPoint.h:41
llvm::APFixedPoint::shl
APFixedPoint shl(unsigned Amt, bool *Overflow=nullptr) const
Definition: APFixedPoint.cpp:347
llvm::APFixedPoint::getMsbWeight
int getMsbWeight() const
Definition: APFixedPoint.h:171
llvm::APFixedPoint::div
APFixedPoint div(const APFixedPoint &Other, bool *Overflow=nullptr) const
Definition: APFixedPoint.cpp:286
uint64_t
llvm::FixedPointSemantics::GetIntegerSemantics
static FixedPointSemantics GetIntegerSemantics(unsigned Width, bool IsSigned)
Return the FixedPointSemantics for an integer type.
Definition: APFixedPoint.h:103
llvm::APFixedPoint::convertToFloat
APFloat convertToFloat(const fltSemantics &FloatSema) const
Convert this fixed point number to a floating point value with the provided semantics.
Definition: APFixedPoint.cpp:487
llvm::APFixedPoint::getSemantics
FixedPointSemantics getSemantics() const
Definition: APFixedPoint.h:175
llvm::APFixedPoint::convertToInt
APSInt convertToInt(unsigned DstWidth, bool DstSign, bool *Overflow=nullptr) const
Return the integral part of this fixed point number, rounded towards zero.
Definition: APFixedPoint.cpp:446
llvm::APInt::getBoolValue
bool getBoolValue() const
Convert APInt to a boolean value.
Definition: APInt.h:452
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::APSInt::isUnsigned
bool isUnsigned() const
Definition: APSInt.h:78
APSInt.h
llvm::APFixedPoint::dump
void dump() const
Definition: APFixedPoint.cpp:426
llvm::APFixedPoint::add
APFixedPoint add(const APFixedPoint &Other, bool *Overflow=nullptr) const
Definition: APFixedPoint.cpp:181
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::FixedPointSemantics::operator!=
bool operator!=(FixedPointSemantics Other) const
Definition: APFixedPoint.h:115
llvm::FixedPointSemantics::fitsInFloatSemantics
bool fitsInFloatSemantics(const fltSemantics &FloatSema) const
Returns true if this fixed-point semantic with its value bits interpreted as an integer can fit in th...
Definition: APFixedPoint.cpp:132
llvm::FixedPointSemantics::WidthBitWidth
static constexpr unsigned WidthBitWidth
Definition: APFixedPoint.h:36
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::APFixedPoint::APFixedPoint
APFixedPoint(const APInt &Val, const FixedPointSemantics &Sema)
Definition: APFixedPoint.h:155
llvm::FixedPointSemantics::operator==
bool operator==(FixedPointSemantics Other) const
Definition: APFixedPoint.h:110
llvm::FixedPointSemantics::getMsbWeight
int getMsbWeight() const
Definition: APFixedPoint.h:64
llvm::DenseMapInfo< APFixedPoint >::getTombstoneKey
static APFixedPoint getTombstoneKey()
Definition: APFixedPoint.h:305
llvm::fltSemantics
Definition: APFloat.cpp:71
llvm::APFixedPoint::mul
APFixedPoint mul(const APFixedPoint &Other, bool *Overflow=nullptr) const
Definition: APFixedPoint.cpp:229
llvm::APFixedPoint::operator==
bool operator==(const APFixedPoint &Other) const
Definition: APFixedPoint.h:245
llvm::APFixedPoint::toString
void toString(SmallVectorImpl< char > &Str) const
Definition: APFixedPoint.cpp:381
llvm::hash_value
hash_code hash_value(const FixedPointSemantics &Val)
Definition: APFixedPoint.h:127
llvm::APFixedPoint::promoteFloatSemantics
static const fltSemantics * promoteFloatSemantics(const fltSemantics *S)
Given a floating point semantic, return the next floating point semantic with a larger exponent and l...
Definition: APFixedPoint.cpp:475
llvm::hash_combine
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition: Hashing.h:605
llvm::APFixedPoint::toString
std::string toString() const
Definition: APFixedPoint.h:234
llvm::SmallVectorImpl< char >
llvm::FixedPointSemantics::FixedPointSemantics
FixedPointSemantics(unsigned Width, Lsb Weight, bool IsSigned, bool IsSaturated, bool HasUnsignedPadding)
Definition: APFixedPoint.h:47
DenseMapInfo.h
llvm::APFixedPoint::convert
APFixedPoint convert(const FixedPointSemantics &DstSema, bool *Overflow=nullptr) const
Definition: APFixedPoint.cpp:32
llvm::APFixedPoint::getFromIntValue
static APFixedPoint getFromIntValue(const APSInt &Value, const FixedPointSemantics &DstFXSema, bool *Overflow=nullptr)
Create an APFixedPoint with a value equal to that of the provided integer, and in the same semantics ...
Definition: APFixedPoint.cpp:523
llvm::APFixedPoint::sub
APFixedPoint sub(const APFixedPoint &Other, bool *Overflow=nullptr) const
Definition: APFixedPoint.cpp:205
raw_ostream.h
llvm::FixedPointSemantics::isValidLegacySema
bool isValidLegacySema() const
Check if the Semantic follow the requirements of an older more limited version of this class.
Definition: APFixedPoint.h:58
llvm::DenseMapInfo< FixedPointSemantics >::getHashValue
static unsigned getHashValue(const FixedPointSemantics &Val)
Definition: APFixedPoint.h:140
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::DenseMapInfo< APFixedPoint >::getHashValue
static unsigned getHashValue(const APFixedPoint &Val)
Definition: APFixedPoint.h:309
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1251
llvm::APFixedPoint::getScale
unsigned getScale() const
Definition: APFixedPoint.h:169
llvm::FixedPointSemantics::getLsbWeight
int getLsbWeight() const
Definition: APFixedPoint.h:63
llvm::hash_code
An opaque object representing a hash code.
Definition: Hashing.h:73