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

99 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
c6cdebbedd Substantially optimize APFloat::toString() by doing a single large divide to
cut the significand down to the desired precision *before* entering the
core divmod loop.  Makes the overall algorithm logarithmic in the exponent.

There's still a lot of room for improvement here, but this gets the
performance back down to acceptable-for-diagnostics levels, even for
long doubles.
negligible, even on long doubles.

llvm-svn: 92130
2009-12-24 12:16:56 +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
Dale Johannesen
3f91e235b8 Commit fixes for half precision I noted in review, so
they don't get lost; I don't think the originator has
write access.

llvm-svn: 84928
2009-10-23 04:02:51 +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
b1cc232ab2 wrap long lines.
llvm-svn: 82715
2009-09-24 21:44:20 +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
31ef120005 Fix typo.
llvm-svn: 79688
2009-08-21 23:09:47 +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
Erick Tryzelaar
6bd69aaa86 Add support for including '+' in APFloat strings, more asserts,
and many new unit tests.

llvm-svn: 79574
2009-08-20 23:30:43 +00:00
Daniel Dunbar
9ad4b47cec Fix two APFloat bugs in converting hexadecimal constants.
llvm-svn: 79540
2009-08-20 17:12:33 +00:00
Erick Tryzelaar
fc2856cec4 Fix an uninitialized value warning in APFloat.
llvm-svn: 79353
2009-08-18 18:20:37 +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
Torok Edwin
f955a6ef49 llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin
ae8a3ff177 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +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
Mike Stump
6666fa7a2c Fix whitespacing (space after switch).
llvm-svn: 71738
2009-05-13 23:23:20 +00:00
Dale Johannesen
34123aba43 Fix internal representation of fp80 to be the
same as a normal i80 {low64, high16} rather
than its own {high64, low16}.  A depressing number
of places know about this; I think I got them all.
Bitcode readers and writers convert back to the old
form to avoid breaking compatibility.

llvm-svn: 67562
2009-03-23 21:16:53 +00:00
Chris Lattner
6f7628bd8e just initialize the first element, we don't need to set the rest to zeros.
llvm-svn: 66850
2009-03-13 00:24:01 +00:00
Chris Lattner
99b48e57ba Eliminate a 9640 byte static mutable initialized data item by moving it
to the stack.  This shrinks all llvm tools by 9k, and improves reentrancy.

llvm-svn: 66847
2009-03-13 00:03:51 +00:00
Chris Lattner
f835ec9a9d static functions don't need an anonymous namespace.
llvm-svn: 66845
2009-03-12 23:59:55 +00:00
Cedric Venet
48be6b5e15 Unbreak the build on win32.
Cleanup some warning.

Remark: when struct/class are declared differently than they are defined, this make problem for VC++ since it seems to mangle class differently that struct. These error are very hard to understand and find. So please, try to keep your definition/declaration in sync.

Only tested with VS2008. hope it does not break anything. feel free to revert.

llvm-svn: 64554
2009-02-14 16:06:42 +00:00
Dale Johannesen
a5699a1e8b Do not use host floating point types when emitting
ASCII IR; loading and storing these can change the
bits of NaNs on some hosts.  Remove or add warnings
at a few other places using host floating point;
this is a bad thing to do in general.

llvm-svn: 62712
2009-01-21 20:32:55 +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
Dale Johannesen
31f3cac06b compile-time fmod was done incorrectly. PR 3316.
llvm-svn: 62528
2009-01-19 21:17:05 +00:00
Bill Wendling
cbebccf936 Get rid of bogus "control may reach end of non-void function ‘...’ being
inlined" message.

llvm-svn: 60165
2008-11-27 08:00:12 +00:00
Evan Cheng
383a9a9264 Revert r60042. IndVarSimplify should check if APFloat is PPCDoubleDouble first before trying to convert it to an integer.
llvm-svn: 60072
2008-11-26 01:11:57 +00:00
Evan Cheng
c11d7e324f convertToSignExtendedInteger should return opInvalidOp instead of asserting if sematics of float does not allow arithmetics.
llvm-svn: 60042
2008-11-25 19:00:29 +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
Dale Johannesen
3b86d974bc Mark negative-zero-to-int conversion as Inexact,
since -0.0 can't be represented as an int.
This prevents llvm from reducing -0.0 to a
load-and-convert of int 0.  Fixes
ieee.exp/mzero[2356].c in gcc testsuite.

llvm-svn: 57224
2008-10-07 00:40:01 +00:00
Dale Johannesen
40d00c0979 Be more precise about which conversions of NaNs
are Inexact.  (These are not Inexact as defined
by IEEE754, but that seems like a reasonable way
to abstract what happens:  information is lost.)

llvm-svn: 57218
2008-10-06 22:59:10 +00:00
Dale Johannesen
24ea5f2be7 Temporarily revert functionality change from my previous patch;
it is too aggressive.

llvm-svn: 57203
2008-10-06 20:43:48 +00:00
Dale Johannesen
89329a1d0a Mark shortening NaN conversions as Inexact. PR 2856.
Improve description of unsupported formats.

llvm-svn: 57185
2008-10-06 18:22:29 +00:00
Chris Lattner
c0610874cc Rework the routines that convert AP[S]Int into a string. Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to 
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.

llvm-svn: 54873
2008-08-17 07:19:36 +00:00
Chris Lattner
4e4a482a41 remove a dead APInt ctor.
llvm-svn: 54869
2008-08-17 04:58:58 +00:00
Dale Johannesen
809ad5df81 Don't assume underlying APInt type is limited
to 64 bits.

llvm-svn: 51135
2008-05-14 22:53:25 +00:00
Dale Johannesen
b9d2bc9303 Remove undefined behavior in hex string->APFloat
conversion.  Try 0x1.0000a4p+0f.  Neil, please review.

llvm-svn: 51132
2008-05-14 22:05:31 +00:00
Dan Gohman
4224373cc8 Make firstEightPowers const.
llvm-svn: 50975
2008-05-12 16:38:14 +00:00
Evan Cheng
c2d34f03bf Suppress -Wshorten-64-to-32 warnings for 64-bit hosts.
llvm-svn: 50590
2008-05-02 21:15:08 +00:00
Dale Johannesen
675fca3ee1 Check that APFloat::convert is not trying to target
ppc long double, which doesn't work.

This may break some stuff temporarily, but I want to
avoid the propagation of code that assumes this works.

llvm-svn: 49983
2008-04-20 01:34:03 +00:00
Dan Gohman
26c2127be9 Make several symbols static.
llvm-svn: 49496
2008-04-10 21:11:47 +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
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
Dale Johannesen
c19b8c41c6 Chris' change to print an approximation to long doubles
exposed a bug in APFloat's long double->double conversion of
NaNs.  Broke several things in the ieee part of gcc testsuite.

llvm-svn: 46617
2008-01-31 18:34:01 +00:00
Dan Gohman
daa38f69cf Remove top-level const qualifiers from casts, avoiding associated
compiler warnings.

llvm-svn: 46509
2008-01-29 12:08:20 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00