1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

48 Commits

Author SHA1 Message Date
John McCall
75f1b8beeb Implement support for converting to string at "natural precision", and fix some
major bugs in long-precision conversion.

llvm-svn: 92150
2009-12-24 23:18:09 +00:00
John McCall
c71c44ec7f Add accessors for the largest-magnitude, smallest-magnitude, and
smallest-normalized-magnitude values in a given FP semantics.
Provide an APFloat-to-string conversion which I am quite ready to admit could
be much more efficient.

llvm-svn: 92126
2009-12-24 08:56:26 +00:00
Evan Cheng
1c7dfce330 Remove getIEEEFloatParts and getIEEEDoubleParts. They are not needed.
llvm-svn: 85358
2009-10-28 01:08:17 +00:00
Evan Cheng
b6b5214744 Add new APFloat methods that return sign, exp, and mantissa of ieee float and double values.
llvm-svn: 85318
2009-10-27 21:35:42 +00:00
Chris Lattner
5d2b384837 Add half precision floating point support (float16) to APFloat,
patch by Peter Johnson! (PR5195)

llvm-svn: 84239
2009-10-16 02:13:51 +00:00
Chris Lattner
09084c45af add a version of the APFloat constructor that initializes to 0.0
llvm-svn: 82110
2009-09-17 01:08:43 +00:00
Anton Korobeynikov
bb4c910976 Implement APInt <-> APFloat conversion for IEEE 128-bit floats.
This fixes PR2555

llvm-svn: 79677
2009-08-21 22:10:30 +00:00
Oscar Fuentes
58ce88fded Make a declaration consistent with its definition.
llvm-svn: 79220
2009-08-17 04:10:20 +00:00
Erick Tryzelaar
930c879b9e Modify APFloat to take a StringRef instead of a c string.
This also adds unit tests to APFloat that mainly tests the
string handling of APFloat, but not much else of it's api.

llvm-svn: 79210
2009-08-16 23:36:19 +00:00
Mike Stump
f39ed4d4f9 Dcoument that the opauque value used to construct QNaNs is truncated
as necessary.

llvm-svn: 72702
2009-06-01 21:02:35 +00:00
Mike Stump
72e70811c8 Add some documentation.
llvm-svn: 72622
2009-05-30 15:19:29 +00:00
Mike Stump
5447116cbb Add support for letting the client choose different flavors of NaNs. Testcase to be
added in clang.

llvm-svn: 72606
2009-05-30 03:49:43 +00:00
Dale Johannesen
6854f86296 Make special cases (0 inf nan) work for frem.
Besides APFloat, this involved removing code
from two places that thought they knew the
result of frem(0., x) but were wrong.

llvm-svn: 62645
2009-01-21 00:35:19 +00:00
Dale Johannesen
c9e6e85a38 Add an IEEE remainder function, which is not
fully implemented yet and not used.  This is
mainly to clarify that APFloat::mod implements
C fmod, not remainder.

llvm-svn: 62593
2009-01-20 18:35:05 +00:00
Misha Brukman
da77da48f3 Removed trailing whitespace.
llvm-svn: 62000
2009-01-09 19:25:42 +00:00
Dale Johannesen
075a62519f Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.

llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Dale Johannesen
9e57068854 Rename APFloat::convertToAPInt to bitcastToAPInt to
make it clearer what the function does.  No functional
change.

llvm-svn: 57325
2008-10-09 18:53:47 +00:00
Chris Lattner
9adb1b56de add convenience 'constructors'
llvm-svn: 52908
2008-06-30 18:02:44 +00:00
Chris Lattner
0e6bb31def add a predicate.
llvm-svn: 51842
2008-06-01 18:09:04 +00:00
Dan Gohman
45a26a462f Add a method to APFloat to convert directly from APInt.
llvm-svn: 47738
2008-02-29 01:26:11 +00:00
Bill Wendling
ebb707d162 Detabify
llvm-svn: 47597
2008-02-26 10:49:39 +00:00
Ted Kremenek
f06b7ac532 Added "Profile" method to APFloat for use with FoldingSet.
Added member template "Add" to FoldingSetNodeID that allows "adding" arbitrary
objects to a profile via dispatch to FoldingSetTrait<T>::Profile().

Removed FoldingSetNodeID::AddAPFloat and FoldingSetNodeID::APInt, as their
functionality is now replaced using the above mentioned member template.

llvm-svn: 46957
2008-02-11 17:24:50 +00:00
Chris Lattner
e0b1ee937a Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)

llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Chris Lattner
8b88401fbe remove dead #include.
llvm-svn: 44711
2007-12-08 19:06:21 +00:00
Chris Lattner
44b8c0e9e1 remove dead #include, APInt.h already has the needed forward decls.
llvm-svn: 44708
2007-12-08 19:00:38 +00:00
Ted Kremenek
846a3448a1 Implemented generic serialization of APFloat.
llvm-svn: 43829
2007-11-07 18:39:22 +00:00
Neil Booth
d04447b7ae When converting to integer, do bit manipulations in the destination
memory rather than in a copy of the APFloat.  This avoids problems
when the destination is wider than our significand and is cleaner.

Also provide deterministic values in all cases where conversion
fails, namely zero for NaNs and the minimal or maximal value
respectively for underflow or overflow.

llvm-svn: 43626
2007-11-01 22:43:37 +00:00
Chris Lattner
ef90913394 add a nice predicate to check to see if nan
llvm-svn: 43304
2007-10-24 18:54:28 +00:00
Neil Booth
1463947f03 Consolidate logic for creating NaNs. Silence compiler warning.
llvm-svn: 42966
2007-10-14 10:39:51 +00:00
Neil Booth
078f455d15 Implement correctly-rounded decimal->binary conversion, i.e. conversion
from user input strings.

Such conversions are more intricate and subtle than they may appear;
it is unlikely I have got it completely right first time.  I would
appreciate being informed of any bugs and incorrect roundings you
might discover.

llvm-svn: 42912
2007-10-12 16:02:31 +00:00
Dale Johannesen
0ee2a2fb59 Next PPC long double bits. First cut at constants.
No compile-time support for constant operations yet,
just format transformations.  Make readers and
writers work.  Split constants into 2 doubles in
Legalize.

llvm-svn: 42865
2007-10-11 18:07:22 +00:00
Neil Booth
6f9602ac12 Add back convertFromSignExtendedInteger.
llvm-svn: 42735
2007-10-07 12:15:41 +00:00
Neil Booth
db4dbedfea Reimplement convertFromUnsignedInteger so it is passed a const bignum.
It used to modify its argument in-place.

This interface is saner and the implementation more efficient.  It will
be needed for decimal->binary conversion.

llvm-svn: 42733
2007-10-07 12:07:53 +00:00
Neil Booth
6e01c5df37 convertFromInteger, as originally written, expected sign-extended
input.  APInt unfortunately zero-extends signed integers, so Dale
modified the function to expect zero-extended input.  Make this
assumption explicit in the function name.

llvm-svn: 42732
2007-10-07 11:45:55 +00:00
Neil Booth
726126f4d6 combineLostFractions does not need to be a member function
llvm-svn: 42729
2007-10-07 08:51:21 +00:00
Neil Booth
2dc065755d Add APFloat -> hexadecimal string conversion, as per %a and %A in C99.
Useful for diagnostics and debugging.

llvm-svn: 42598
2007-10-03 22:26:02 +00:00
Neil Booth
1e709921bc Tweak RoundAwayFromZero the bit number below which is truncated, and make
it const.

Preparation for APFloat -> hexadecimal string conversion.

llvm-svn: 42576
2007-10-03 15:16:41 +00:00
Neil Booth
3680e05d98 Whitespace cleanup.
llvm-svn: 42374
2007-09-26 21:35:05 +00:00
Chris Lattner
7b29e6a714 Make single-argument ctors explicit to avoid tricky bugs :)
llvm-svn: 41924
2007-09-13 06:15:57 +00:00
Dale Johannesen
7bc3969cea Add APInt interfaces to APFloat (allows directly
access to bits).  Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling 
(untested, probably does not work).

llvm-svn: 41858
2007-09-11 18:32:33 +00:00
Chuck Rose III
788df70ec3 Fix for VisualStudio. It is treating a 2 bit enum as a signed int for comparison purposes, causing failures. Using an extra bit fixes it.
llvm-svn: 41784
2007-09-08 04:17:08 +00:00
Dale Johannesen
b34e6b4898 Add mod, copysign, abs operations to APFloat.
Implement some constant folding in SelectionDAG and
DAGCombiner using APFloat.  Remove double versions
of constructor and getValue from ConstantFPSDNode.

llvm-svn: 41664
2007-08-31 23:34:27 +00:00
Dale Johannesen
81d6ecb886 Enhance APFloat to retain bits of NaNs (fixes oggenc).
Use APFloat interfaces for more references, mostly
of ConstantFPSDNode.

llvm-svn: 41632
2007-08-31 04:03:46 +00:00
Dale Johannesen
ab02edb700 Comment out declaration of operator== (undefined).
llvm-svn: 41383
2007-08-25 00:40:41 +00:00
Dale Johannesen
9ec1e28e79 Poison APFloat::operator==. Replace existing uses with bitwiseIsEqual.
This means backing out the preceding change to Constants.cpp, alas.

llvm-svn: 41378
2007-08-24 22:09:56 +00:00
Dale Johannesen
0aaabb858b Revised per review feedback from previous patch.
llvm-svn: 41353
2007-08-24 05:08:11 +00:00
Dale Johannesen
a3ab055b9d Change internal representation of ConstantFP to use APFloat.
Interface to rest of the compiler unchanged, as yet.

llvm-svn: 41348
2007-08-24 00:56:33 +00:00
Chris Lattner
401698e8b5 initial checkin of Neil's APFloat work.
llvm-svn: 41203
2007-08-20 22:49:32 +00:00