LLVM API Documentation

llvm::APFloat Class Reference

#include <APFloat.h>

Collaboration diagram for llvm::APFloat:
[legend]

List of all members.

Public Types

enum  cmpResult { cmpLessThan, cmpEqual, cmpGreaterThan, cmpUnordered }
enum  roundingMode {
  rmNearestTiesToEven, rmTowardPositive, rmTowardNegative, rmTowardZero,
  rmNearestTiesToAway
}
enum  opStatus {
  opOK = 0x00, opInvalidOp = 0x01, opDivByZero = 0x02, opOverflow = 0x04,
  opUnderflow = 0x08, opInexact = 0x10
}
enum  fltCategory { fcInfinity, fcNaN, fcNormal, fcZero }

Public Member Functions

 APFloat (const fltSemantics &, const StringRef &)
 APFloat (const fltSemantics &, integerPart)
 APFloat (const fltSemantics &, fltCategory, bool negative, unsigned type=0)
 APFloat (double d)
 APFloat (float f)
 APFloat (const APInt &, bool isIEEE=false)
 APFloat (const APFloat &)
 ~APFloat ()
void Profile (FoldingSetNodeID &NID) const
void Emit (Serializer &S) const
 Used by the Bitcode serializer to emit APInts to Bitcode.
opStatus add (const APFloat &, roundingMode)
opStatus subtract (const APFloat &, roundingMode)
opStatus multiply (const APFloat &, roundingMode)
opStatus divide (const APFloat &, roundingMode)
opStatus remainder (const APFloat &)
opStatus mod (const APFloat &, roundingMode)
opStatus fusedMultiplyAdd (const APFloat &, const APFloat &, roundingMode)
void changeSign ()
void clearSign ()
void copySign (const APFloat &)
opStatus convert (const fltSemantics &, roundingMode, bool *)
opStatus convertToInteger (integerPart *, unsigned int, bool, roundingMode, bool *) const
opStatus convertFromAPInt (const APInt &, bool, roundingMode)
opStatus convertFromSignExtendedInteger (const integerPart *, unsigned int, bool, roundingMode)
opStatus convertFromZeroExtendedInteger (const integerPart *, unsigned int, bool, roundingMode)
opStatus convertFromString (const StringRef &, roundingMode)
APInt bitcastToAPInt () const
double convertToDouble () const
float convertToFloat () const
cmpResult compare (const APFloat &) const
bool bitwiseIsEqual (const APFloat &) const
unsigned int convertToHexString (char *dst, unsigned int hexDigits, bool upperCase, roundingMode) const
fltCategory getCategory () const
const fltSemantics & getSemantics () const
bool isZero () const
bool isNonZero () const
bool isNaN () const
bool isInfinity () const
bool isNegative () const
bool isPosZero () const
bool isNegZero () const
APFloat & operator= (const APFloat &)
uint32_t getHashValue () const

Static Public Member Functions

static unsigned int semanticsPrecision (const fltSemantics &)
static APFloat getZero (const fltSemantics &Sem, bool Negative=false)
static APFloat getInf (const fltSemantics &Sem, bool Negative=false)
static APFloat getNaN (const fltSemantics &Sem, bool Negative=false, unsigned type=0)
static APFloat ReadVal (Deserializer &D)
 Used by the Bitcode deserializer to deserialize APInts.

Static Public Attributes

static const fltSemantics IEEEsingle = { 127, -126, 24, true }
static const fltSemantics IEEEdouble = { 1023, -1022, 53, true }
static const fltSemantics IEEEquad = { 16383, -16382, 113, true }
static const fltSemantics PPCDoubleDouble = { 1023, -1022, 106, false }
static const fltSemantics x87DoubleExtended = { 16383, -16382, 64, true }
static const fltSemantics Bogus = { 0, 0, 0, true }

Classes

union  Significand


Detailed Description

Definition at line 124 of file APFloat.h.


Member Enumeration Documentation

Enumerator:
cmpLessThan 
cmpEqual 
cmpGreaterThan 
cmpUnordered 

Definition at line 140 of file APFloat.h.

Enumerator:
rmNearestTiesToEven 
rmTowardPositive 
rmTowardNegative 
rmTowardZero 
rmNearestTiesToAway 

Definition at line 148 of file APFloat.h.

Enumerator:
opOK 
opInvalidOp 
opDivByZero 
opOverflow 
opUnderflow 
opInexact 

Definition at line 158 of file APFloat.h.

Enumerator:
fcInfinity 
fcNaN 
fcNormal 
fcZero 

Definition at line 168 of file APFloat.h.


Constructor & Destructor Documentation

APFloat::APFloat ( const fltSemantics &  ourSemantics,
const StringRef &  text 
)

Definition at line 708 of file APFloat.cpp.

References assertArithmeticOK(), convertFromString(), and rmNearestTiesToEven.

Referenced by getInf(), getNaN(), getZero(), and ReadVal().

APFloat::APFloat ( const fltSemantics &  ourSemantics,
integerPart  value 
)

APFloat::APFloat ( const fltSemantics &  ourSemantics,
fltCategory  ourCategory,
bool  negative,
unsigned  type = 0 
)

Definition at line 695 of file APFloat.cpp.

References assertArithmeticOK(), fcNaN, fcNormal, and fcZero.

APFloat::APFloat ( double  d  )  [explicit]

Definition at line 3075 of file APFloat.cpp.

References llvm::APInt::doubleToBits().

APFloat::APFloat ( float  f  )  [explicit]

Definition at line 3069 of file APFloat.cpp.

References llvm::APInt::floatToBits().

APFloat::APFloat ( const APInt &  api,
bool  isIEEE = false 
) [explicit]

Definition at line 3064 of file APFloat.cpp.

APFloat::APFloat ( const APFloat &  rhs  ) 

Definition at line 715 of file APFloat.cpp.

References semantics.

APFloat::~APFloat (  ) 

Definition at line 721 of file APFloat.cpp.


Member Function Documentation

unsigned int APFloat::semanticsPrecision ( const fltSemantics &  semantics  )  [static]

Definition at line 738 of file APFloat.cpp.

References llvm::fltSemantics::precision.

static APFloat llvm::APFloat::getZero ( const fltSemantics &  Sem,
bool  Negative = false 
) [inline, static]

Definition at line 186 of file APFloat.h.

References APFloat(), and fcZero.

static APFloat llvm::APFloat::getInf ( const fltSemantics &  Sem,
bool  Negative = false 
) [inline, static]

Definition at line 189 of file APFloat.h.

References APFloat(), and fcInfinity.

static APFloat llvm::APFloat::getNaN ( const fltSemantics &  Sem,
bool  Negative = false,
unsigned  type = 0 
) [inline, static]

getNaN - Factory for QNaN values.

Parameters:
Negative - True iff the NaN generated should be negative.
type - The unspecified fill bits for creating the NaN, 0 by default. The value is truncated as necessary.

Definition at line 197 of file APFloat.h.

References APFloat(), fcNaN, and type.

void APFloat::Profile ( FoldingSetNodeID &  NID  )  const

Profile - Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets.

Definition at line 727 of file APFloat.cpp.

References llvm::FoldingSetNodeID::Add(), and bitcastToAPInt().

void APFloat::Emit ( Serializer &  S  )  const

Used by the Bitcode serializer to emit APInts to Bitcode.

Definition at line 19 of file SerializeAPFloat.cpp.

References bitcastToAPInt(), and llvm::Serializer::Emit().

APFloat APFloat::ReadVal ( Deserializer &  D  )  [static]

Used by the Bitcode deserializer to deserialize APInts.

Definition at line 19 of file DeserializeAPFloat.cpp.

References APFloat(), and llvm::Deserializer::Read().

APFloat::opStatus APFloat::add ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::subtract ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::multiply ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::divide ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::remainder ( const APFloat &  rhs  ) 

APFloat::opStatus APFloat::mod ( const APFloat &  rhs,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::fusedMultiplyAdd ( const APFloat &  multiplicand,
const APFloat &  addend,
roundingMode  rounding_mode 
)

void APFloat::changeSign (  ) 

void APFloat::clearSign (  ) 

Definition at line 1483 of file APFloat.cpp.

Referenced by llvm::SelectionDAG::getNode().

void APFloat::copySign ( const APFloat &  rhs  ) 

Definition at line 1490 of file APFloat.cpp.

References sign.

Referenced by llvm::SelectionDAG::getNode().

APFloat::opStatus APFloat::convert ( const fltSemantics &  toSemantics,
roundingMode  rounding_mode,
bool *  losesInfo 
)

APFloat::convert - convert a value of one floating point type to another. The return value corresponds to the IEEE754 exceptions. *losesInfo records whether the transformation lost information, i.e. whether converting the result back to the original type will produce the original value (this is almost the same as return value==fsOK, but there are edge cases where this is not so).

Definition at line 1791 of file APFloat.cpp.

References assertArithmeticOK(), fcNaN, fcNormal, llvm::lfExactlyZero, lostFractionThroughTruncation(), opOK, partCountForBits(), llvm::fltSemantics::precision, llvm::APInt::tcAssign(), llvm::APInt::tcLSB(), llvm::APInt::tcSet(), llvm::APInt::tcShiftLeft(), llvm::APInt::tcShiftRight(), and x87DoubleExtended.

Referenced by llvm::ConstantFoldCastInstruction(), FitsInFPType(), llvm::ConstantFP::get(), llvm::SelectionDAG::getNode(), llvm::ConstantFP::isExactlyValue(), llvm::ConstantFPSDNode::isExactlyValue(), isFPCSafeToPrint(), llvm::ConstantFPSDNode::isValueValidForType(), llvm::ConstantFP::isValueValidForType(), WriteConstantInt(), and llvm::X86TargetLowering::X86TargetLowering().

APFloat::opStatus APFloat::convertToInteger ( integerPart *  parts,
unsigned int  width,
bool  isSigned,
roundingMode  rounding_mode,
bool *  isExact 
) const

APFloat::opStatus APFloat::convertFromAPInt ( const APInt &  Val,
bool  isSigned,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::convertFromSignExtendedInteger ( const integerPart *  src,
unsigned int  srcCount,
bool  isSigned,
roundingMode  rounding_mode 
)

APFloat::opStatus APFloat::convertFromZeroExtendedInteger ( const integerPart *  parts,
unsigned int  width,
bool  isSigned,
roundingMode  rounding_mode 
)

Definition at line 2117 of file APFloat.cpp.

References llvm::APInt::getRawData(), partCountForBits(), and llvm::APInt::tcExtractBit().

Referenced by mod(), and remainder().

APFloat::opStatus APFloat::convertFromString ( const StringRef &  str,
roundingMode  rounding_mode 
)

APInt APFloat::bitcastToAPInt (  )  const

double APFloat::convertToDouble (  )  const

float APFloat::convertToFloat (  )  const

Definition at line 2832 of file APFloat.cpp.

References bitcastToAPInt(), llvm::APInt::bitsToFloat(), and IEEEsingle.

Referenced by llvm::ftostr(), and isFPS16Immediate().

APFloat::cmpResult APFloat::compare ( const APFloat &  rhs  )  const

bool APFloat::bitwiseIsEqual ( const APFloat &  rhs  )  const

unsigned int APFloat::convertToHexString ( char *  dst,
unsigned int  hexDigits,
bool  upperCase,
roundingMode  rounding_mode 
) const

fltCategory llvm::APFloat::getCategory (  )  const [inline]

Definition at line 263 of file APFloat.h.

const fltSemantics& llvm::APFloat::getSemantics (  )  const [inline]

bool llvm::APFloat::isZero (  )  const [inline]

Definition at line 265 of file APFloat.h.

References fcZero.

Referenced by isNegZero(), llvm::ConstantFP::isNullValue(), isPosZero(), mod(), and remainder().

bool llvm::APFloat::isNonZero (  )  const [inline]

Definition at line 266 of file APFloat.h.

References fcZero.

bool llvm::APFloat::isNaN (  )  const [inline]

Definition at line 267 of file APFloat.h.

References fcNaN.

bool llvm::APFloat::isInfinity (  )  const [inline]

Definition at line 268 of file APFloat.h.

References fcInfinity.

bool llvm::APFloat::isNegative (  )  const [inline]

bool llvm::APFloat::isPosZero (  )  const [inline]

Definition at line 270 of file APFloat.h.

References isNegative(), and isZero().

bool llvm::APFloat::isNegZero (  )  const [inline]

Definition at line 271 of file APFloat.h.

References isNegative(), and isZero().

APFloat & APFloat::operator= ( const APFloat &  rhs  ) 

Definition at line 641 of file APFloat.cpp.

References semantics.

uint32_t APFloat::getHashValue (  )  const


Member Data Documentation

const fltSemantics llvm::APFloat::IEEEsingle = { 127, -126, 24, true } [static]

const fltSemantics llvm::APFloat::IEEEdouble = { 1023, -1022, 53, true } [static]

const fltSemantics llvm::APFloat::IEEEquad = { 16383, -16382, 113, true } [static]

const fltSemantics llvm::APFloat::PPCDoubleDouble = { 1023, -1022, 106, false } [static]

const fltSemantics llvm::APFloat::x87DoubleExtended = { 16383, -16382, 64, true } [static]

const fltSemantics llvm::APFloat::Bogus = { 0, 0, 0, true } [static]


The documentation for this class was generated from the following files: