15
15
#ifndef LLVM_ADT_APFLOAT_H
16
16
#define LLVM_ADT_APFLOAT_H
17
17
18
- #include " llvm/Support/Compiler.h"
19
18
#include " llvm/ADT/APInt.h"
20
19
#include " llvm/ADT/ArrayRef.h"
21
20
#include " llvm/ADT/FloatingPointMode.h"
21
+ #include " llvm/Support/Compiler.h"
22
22
#include " llvm/Support/ErrorHandling.h"
23
23
#include " llvm/Support/float128.h"
24
24
#include < memory>
@@ -285,7 +285,8 @@ struct APFloatBase {
285
285
// Returns true if any number described by this semantics can be precisely
286
286
// represented by the specified semantics. Does not take into account
287
287
// the value of fltNonfiniteBehavior, hasZero, hasSignedRepr.
288
- LLVM_ABI static bool isRepresentableBy (const fltSemantics &A, const fltSemantics &B);
288
+ LLVM_ABI static bool isRepresentableBy (const fltSemantics &A,
289
+ const fltSemantics &B);
289
290
290
291
// / @}
291
292
@@ -349,7 +350,8 @@ struct APFloatBase {
349
350
LLVM_ABI static ExponentType semanticsMinExponent (const fltSemantics &);
350
351
LLVM_ABI static ExponentType semanticsMaxExponent (const fltSemantics &);
351
352
LLVM_ABI static unsigned int semanticsSizeInBits (const fltSemantics &);
352
- LLVM_ABI static unsigned int semanticsIntSizeInBits (const fltSemantics&, bool );
353
+ LLVM_ABI static unsigned int semanticsIntSizeInBits (const fltSemantics &,
354
+ bool );
353
355
LLVM_ABI static bool semanticsHasZero (const fltSemantics &);
354
356
LLVM_ABI static bool semanticsHasSignedRepr (const fltSemantics &);
355
357
LLVM_ABI static bool semanticsHasInf (const fltSemantics &);
@@ -360,7 +362,7 @@ struct APFloatBase {
360
362
// Returns true if any number described by \p Src can be precisely represented
361
363
// by a normal (not subnormal) value in \p Dst.
362
364
LLVM_ABI static bool isRepresentableAsNormalIn (const fltSemantics &Src,
363
- const fltSemantics &Dst);
365
+ const fltSemantics &Dst);
364
366
365
367
// / Returns the size of the floating point number (in bits) in the given
366
368
// / semantics.
@@ -436,7 +438,8 @@ class IEEEFloat final {
436
438
LLVM_ABI opStatus remainder (const IEEEFloat &);
437
439
// / C fmod, or llvm frem.
438
440
LLVM_ABI opStatus mod (const IEEEFloat &);
439
- LLVM_ABI opStatus fusedMultiplyAdd (const IEEEFloat &, const IEEEFloat &, roundingMode);
441
+ LLVM_ABI opStatus fusedMultiplyAdd (const IEEEFloat &, const IEEEFloat &,
442
+ roundingMode);
440
443
LLVM_ABI opStatus roundToIntegral (roundingMode);
441
444
// / IEEE-754R 5.3.1: nextUp/nextDown.
442
445
LLVM_ABI opStatus next (bool nextDown);
@@ -454,13 +457,15 @@ class IEEEFloat final {
454
457
// / @{
455
458
456
459
LLVM_ABI opStatus convert (const fltSemantics &, roundingMode, bool *);
457
- LLVM_ABI opStatus convertToInteger (MutableArrayRef<integerPart>, unsigned int , bool ,
458
- roundingMode, bool *) const ;
460
+ LLVM_ABI opStatus convertToInteger (MutableArrayRef<integerPart>, unsigned int ,
461
+ bool , roundingMode, bool *) const ;
459
462
LLVM_ABI opStatus convertFromAPInt (const APInt &, bool , roundingMode);
460
- LLVM_ABI opStatus convertFromSignExtendedInteger (const integerPart *, unsigned int ,
461
- bool , roundingMode);
462
- LLVM_ABI opStatus convertFromZeroExtendedInteger (const integerPart *, unsigned int ,
463
- bool , roundingMode);
463
+ LLVM_ABI opStatus convertFromSignExtendedInteger (const integerPart *,
464
+ unsigned int , bool ,
465
+ roundingMode);
466
+ LLVM_ABI opStatus convertFromZeroExtendedInteger (const integerPart *,
467
+ unsigned int , bool ,
468
+ roundingMode);
464
469
LLVM_ABI Expected<opStatus> convertFromString (StringRef, roundingMode);
465
470
LLVM_ABI APInt bitcastToAPInt () const ;
466
471
LLVM_ABI double convertToDouble () const ;
@@ -487,7 +492,7 @@ class IEEEFloat final {
487
492
// / which must be of sufficient size, in the C99 form [-]0xh.hhhhp[+-]d.
488
493
// / Return the number of characters written, excluding the terminating NUL.
489
494
LLVM_ABI unsigned int convertToHexString (char *dst, unsigned int hexDigits,
490
- bool upperCase, roundingMode) const ;
495
+ bool upperCase, roundingMode) const ;
491
496
492
497
// / \name IEEE-754R 5.7.2 General operations.
493
498
// / @{
@@ -595,17 +600,18 @@ class IEEEFloat final {
595
600
// / 1.01E-2 5 2 0.0101
596
601
// / 1.01E-2 4 2 0.0101
597
602
// / 1.01E-2 4 1 1.01E-2
598
- LLVM_ABI void toString (SmallVectorImpl<char > &Str, unsigned FormatPrecision = 0 ,
599
- unsigned FormatMaxPadding = 3 , bool TruncateZero = true ) const ;
603
+ LLVM_ABI void toString (SmallVectorImpl<char > &Str,
604
+ unsigned FormatPrecision = 0 ,
605
+ unsigned FormatMaxPadding = 3 ,
606
+ bool TruncateZero = true ) const ;
600
607
601
608
// / If this value has an exact multiplicative inverse, store it in inv and
602
609
// / return true.
603
610
LLVM_ABI bool getExactInverse (APFloat *inv) const ;
604
611
605
612
// If this is an exact power of two, return the exponent while ignoring the
606
613
// sign bit. If it's not an exact power of 2, return INT_MIN
607
- LLVM_ABI LLVM_READONLY
608
- int getExactLog2Abs () const ;
614
+ LLVM_ABI LLVM_READONLY int getExactLog2Abs () const ;
609
615
610
616
// If this is an exact power of two, return the exponent. If it's not an exact
611
617
// power of 2, return INT_MIN
@@ -636,7 +642,7 @@ class IEEEFloat final {
636
642
LLVM_ABI void makeLargest (bool Neg = false );
637
643
LLVM_ABI void makeSmallest (bool Neg = false );
638
644
LLVM_ABI void makeNaN (bool SNaN = false , bool Neg = false ,
639
- const APInt *fill = nullptr );
645
+ const APInt *fill = nullptr );
640
646
LLVM_ABI void makeInf (bool Neg = false );
641
647
LLVM_ABI void makeZero (bool Neg = false );
642
648
LLVM_ABI void makeQuiet ();
@@ -822,7 +828,8 @@ class DoubleAPFloat final {
822
828
LLVM_ABI DoubleAPFloat (const fltSemantics &S, uninitializedTag);
823
829
LLVM_ABI DoubleAPFloat (const fltSemantics &S, integerPart);
824
830
LLVM_ABI DoubleAPFloat (const fltSemantics &S, const APInt &I);
825
- LLVM_ABI DoubleAPFloat (const fltSemantics &S, APFloat &&First, APFloat &&Second);
831
+ LLVM_ABI DoubleAPFloat (const fltSemantics &S, APFloat &&First,
832
+ APFloat &&Second);
826
833
LLVM_ABI DoubleAPFloat (const DoubleAPFloat &RHS);
827
834
LLVM_ABI DoubleAPFloat (DoubleAPFloat &&RHS);
828
835
~DoubleAPFloat ();
@@ -844,7 +851,8 @@ class DoubleAPFloat final {
844
851
LLVM_ABI opStatus remainder (const DoubleAPFloat &RHS);
845
852
LLVM_ABI opStatus mod (const DoubleAPFloat &RHS);
846
853
LLVM_ABI opStatus fusedMultiplyAdd (const DoubleAPFloat &Multiplicand,
847
- const DoubleAPFloat &Addend, roundingMode RM);
854
+ const DoubleAPFloat &Addend,
855
+ roundingMode RM);
848
856
LLVM_ABI opStatus roundToIntegral (roundingMode RM);
849
857
LLVM_ABI void changeSign ();
850
858
LLVM_ABI cmpResult compareAbsoluteValue (const DoubleAPFloat &RHS) const ;
@@ -866,17 +874,21 @@ class DoubleAPFloat final {
866
874
LLVM_ABI opStatus next (bool nextDown);
867
875
868
876
LLVM_ABI opStatus convertToInteger (MutableArrayRef<integerPart> Input,
869
- unsigned int Width, bool IsSigned, roundingMode RM,
870
- bool *IsExact) const ;
871
- LLVM_ABI opStatus convertFromAPInt (const APInt &Input, bool IsSigned, roundingMode RM);
877
+ unsigned int Width, bool IsSigned,
878
+ roundingMode RM, bool *IsExact) const ;
879
+ LLVM_ABI opStatus convertFromAPInt (const APInt &Input, bool IsSigned,
880
+ roundingMode RM);
872
881
LLVM_ABI opStatus convertFromSignExtendedInteger (const integerPart *Input,
873
- unsigned int InputSize, bool IsSigned,
874
- roundingMode RM);
882
+ unsigned int InputSize,
883
+ bool IsSigned,
884
+ roundingMode RM);
875
885
LLVM_ABI opStatus convertFromZeroExtendedInteger (const integerPart *Input,
876
- unsigned int InputSize, bool IsSigned,
877
- roundingMode RM);
886
+ unsigned int InputSize,
887
+ bool IsSigned,
888
+ roundingMode RM);
878
889
LLVM_ABI unsigned int convertToHexString (char *DST, unsigned int HexDigits,
879
- bool UpperCase, roundingMode RM) const ;
890
+ bool UpperCase,
891
+ roundingMode RM) const ;
880
892
881
893
LLVM_ABI bool isDenormal () const ;
882
894
LLVM_ABI bool isSmallest () const ;
@@ -885,22 +897,22 @@ class DoubleAPFloat final {
885
897
LLVM_ABI bool isInteger () const ;
886
898
887
899
LLVM_ABI void toString (SmallVectorImpl<char > &Str, unsigned FormatPrecision,
888
- unsigned FormatMaxPadding, bool TruncateZero = true ) const ;
900
+ unsigned FormatMaxPadding,
901
+ bool TruncateZero = true ) const ;
889
902
890
903
LLVM_ABI bool getExactInverse (APFloat *inv) const ;
891
904
892
- LLVM_ABI LLVM_READONLY
893
- int getExactLog2 () const ;
894
- LLVM_ABI LLVM_READONLY
895
- int getExactLog2Abs () const ;
905
+ LLVM_ABI LLVM_READONLY int getExactLog2 () const ;
906
+ LLVM_ABI LLVM_READONLY int getExactLog2Abs () const ;
896
907
897
908
friend DoubleAPFloat scalbn (const DoubleAPFloat &X, int Exp, roundingMode);
898
909
friend DoubleAPFloat frexp (const DoubleAPFloat &X, int &Exp, roundingMode);
899
910
friend hash_code hash_value (const DoubleAPFloat &Arg);
900
911
};
901
912
902
913
LLVM_ABI hash_code hash_value (const DoubleAPFloat &Arg);
903
- LLVM_ABI DoubleAPFloat scalbn (const DoubleAPFloat &Arg, int Exp, roundingMode RM);
914
+ LLVM_ABI DoubleAPFloat scalbn (const DoubleAPFloat &Arg, int Exp,
915
+ roundingMode RM);
904
916
LLVM_ABI DoubleAPFloat frexp (const DoubleAPFloat &X, int &Exp, roundingMode);
905
917
906
918
} // End detail namespace
@@ -1328,15 +1340,15 @@ class APFloat : public APFloatBase {
1328
1340
}
1329
1341
1330
1342
LLVM_ABI opStatus convert (const fltSemantics &ToSemantics, roundingMode RM,
1331
- bool *losesInfo);
1343
+ bool *losesInfo);
1332
1344
opStatus convertToInteger (MutableArrayRef<integerPart> Input,
1333
1345
unsigned int Width, bool IsSigned, roundingMode RM,
1334
1346
bool *IsExact) const {
1335
1347
APFLOAT_DISPATCH_ON_SEMANTICS (
1336
1348
convertToInteger (Input, Width, IsSigned, RM, IsExact));
1337
1349
}
1338
1350
LLVM_ABI opStatus convertToInteger (APSInt &Result, roundingMode RM,
1339
- bool *IsExact) const ;
1351
+ bool *IsExact) const ;
1340
1352
opStatus convertFromAPInt (const APInt &Input, bool IsSigned,
1341
1353
roundingMode RM) {
1342
1354
APFLOAT_DISPATCH_ON_SEMANTICS (convertFromAPInt (Input, IsSigned, RM));
0 commit comments