LLVM 20.0.0git
Classes | Namespaces | Macros | Enumerations | Functions | Variables
APFloat.cpp File Reference
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <cstring>
#include <limits.h>

Go to the source code of this file.

Classes

struct  llvm::fltSemantics
 
struct  llvm::decimalInfo
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::detail
 These are wrappers over isa* function that allow them to be used in generic algorithms such as llvm:all_of, llvm::none_of, etc.
 

Macros

#define APFLOAT_DISPATCH_ON_SEMANTICS(METHOD_CALL)
 
#define PackCategoriesIntoKey(_lhs, _rhs)   ((_lhs) * 4 + (_rhs))
 A macro used to combine two fcCategory enums into one key which can be used in a switch statement to classify how the interaction of two APFloat's categories affects an operation.
 

Enumerations

enum class  llvm::fltNonfiniteBehavior { llvm::IEEE754 , llvm::NanOnly , llvm::FiniteOnly }
 
enum class  llvm::fltNanEncoding { llvm::IEEE , llvm::AllOnes , llvm::NegativeZero }
 

Functions

static constexpr APFloatBase::ExponentType llvm::exponentZero (const fltSemantics &semantics)
 
static constexpr APFloatBase::ExponentType llvm::exponentInf (const fltSemantics &semantics)
 
static constexpr APFloatBase::ExponentType llvm::exponentNaN (const fltSemantics &semantics)
 
static Error llvm::createError (const Twine &Err)
 
static constexpr unsigned int llvm::partCountForBits (unsigned int bits)
 
static unsigned int llvm::decDigitValue (unsigned int c)
 
static Expected< int > llvm::readExponent (StringRef::iterator begin, StringRef::iterator end)
 
static Expected< int > llvm::totalExponent (StringRef::iterator p, StringRef::iterator end, int exponentAdjustment)
 
static Expected< StringRef::iteratorllvm::skipLeadingZeroesAndAnyDot (StringRef::iterator begin, StringRef::iterator end, StringRef::iterator *dot)
 
static Error llvm::interpretDecimal (StringRef::iterator begin, StringRef::iterator end, decimalInfo *D)
 
static Expected< lostFractionllvm::trailingHexadecimalFraction (StringRef::iterator p, StringRef::iterator end, unsigned int digitValue)
 
static lostFraction llvm::lostFractionThroughTruncation (const APFloatBase::integerPart *parts, unsigned int partCount, unsigned int bits)
 
static lostFraction llvm::shiftRight (APFloatBase::integerPart *dst, unsigned int parts, unsigned int bits)
 
static lostFraction llvm::combineLostFractions (lostFraction moreSignificant, lostFraction lessSignificant)
 
static unsigned int llvm::HUerrBound (bool inexactMultiply, unsigned int HUerr1, unsigned int HUerr2)
 
static APFloatBase::integerPart llvm::ulpsFromBoundary (const APFloatBase::integerPart *parts, unsigned int bits, bool isNearest)
 
static unsigned int llvm::powerOf5 (APFloatBase::integerPart *dst, unsigned int power)
 
static unsigned int llvm::partAsHex (char *dst, APFloatBase::integerPart part, unsigned int count, const char *hexDigitChars)
 
static charllvm::writeUnsignedDecimal (char *dst, unsigned int n)
 
static charllvm::writeSignedDecimal (char *dst, int value)
 
static void llvm::detail::tcSetLeastSignificantBits (APInt::WordType *dst, unsigned parts, unsigned bits)
 
hash_code llvm::detail::hash_value (const IEEEFloat &Arg)
 
int llvm::detail::ilogb (const IEEEFloat &Arg)
 
IEEEFloat llvm::detail::scalbn (IEEEFloat X, int Exp, IEEEFloat::roundingMode)
 
IEEEFloat llvm::detail::frexp (const IEEEFloat &Val, int &Exp, IEEEFloat::roundingMode RM)
 
hash_code llvm::detail::hash_value (const DoubleAPFloat &Arg)
 
DoubleAPFloat llvm::detail::scalbn (const DoubleAPFloat &Arg, int Exp, APFloat::roundingMode RM)
 
DoubleAPFloat llvm::detail::frexp (const DoubleAPFloat &Arg, int &Exp, APFloat::roundingMode RM)
 
hash_code llvm::hash_value (const APFloat &Arg)
 See friend declarations above.
 

Variables

static constexpr fltSemantics llvm::semIEEEhalf = {15, -14, 11, 16}
 
static constexpr fltSemantics llvm::semBFloat = {127, -126, 8, 16}
 
static constexpr fltSemantics llvm::semIEEEsingle = {127, -126, 24, 32}
 
static constexpr fltSemantics llvm::semIEEEdouble = {1023, -1022, 53, 64}
 
static constexpr fltSemantics llvm::semIEEEquad = {16383, -16382, 113, 128}
 
static constexpr fltSemantics llvm::semFloat8E5M2 = {15, -14, 3, 8}
 
static constexpr fltSemantics llvm::semFloat8E5M2FNUZ
 
static constexpr fltSemantics llvm::semFloat8E4M3 = {7, -6, 4, 8}
 
static constexpr fltSemantics llvm::semFloat8E4M3FN
 
static constexpr fltSemantics llvm::semFloat8E4M3FNUZ
 
static constexpr fltSemantics llvm::semFloat8E4M3B11FNUZ
 
static constexpr fltSemantics llvm::semFloat8E3M4 = {3, -2, 5, 8}
 
static constexpr fltSemantics llvm::semFloatTF32 = {127, -126, 11, 19}
 
static constexpr fltSemantics llvm::semFloat6E3M2FN
 
static constexpr fltSemantics llvm::semFloat6E2M3FN
 
static constexpr fltSemantics llvm::semFloat4E2M1FN
 
static constexpr fltSemantics llvm::semX87DoubleExtended = {16383, -16382, 64, 80}
 
static constexpr fltSemantics llvm::semBogus = {0, 0, 0, 0}
 
static constexpr fltSemantics llvm::semPPCDoubleDouble = {-1, 0, 0, 128}
 
static constexpr fltSemantics llvm::semPPCDoubleDoubleLegacy
 
const unsigned int llvm::maxExponent = 16383
 
const unsigned int llvm::maxPrecision = 113
 
const unsigned int llvm::maxPowerOfFiveExponent = maxExponent + maxPrecision - 1
 
const unsigned int llvm::maxPowerOfFiveParts
 
static const char llvm::hexDigitsLower [] = "0123456789abcdef0"
 
static const char llvm::hexDigitsUpper [] = "0123456789ABCDEF0"
 
static const char llvm::infinityL [] = "infinity"
 
static const char llvm::infinityU [] = "INFINITY"
 
static const char llvm::NaNL [] = "nan"
 
static const char llvm::NaNU [] = "NAN"
 

Macro Definition Documentation

◆ APFLOAT_DISPATCH_ON_SEMANTICS

#define APFLOAT_DISPATCH_ON_SEMANTICS (   METHOD_CALL)
Value:
do { \
if (usesLayout<IEEEFloat>(getSemantics())) \
return U.IEEE.METHOD_CALL; \
if (usesLayout<DoubleAPFloat>(getSemantics())) \
return U.Double.METHOD_CALL; \
llvm_unreachable("Unexpected semantics"); \
} while (false)

Definition at line 31 of file APFloat.cpp.

◆ PackCategoriesIntoKey

#define PackCategoriesIntoKey (   _lhs,
  _rhs 
)    ((_lhs) * 4 + (_rhs))

A macro used to combine two fcCategory enums into one key which can be used in a switch statement to classify how the interaction of two APFloat's categories affects an operation.

TODO: If clang source code is ever allowed to use constexpr in its own codebase, change this into a static inline function.

Definition at line 48 of file APFloat.cpp.