Eli Friedman
195464184e
Fix APInt::operator*= so that it computes the correct result for large integers where there is unsigned overflow. Fix APFloat::toString so that it doesn't depend on the incorrect behavior in common cases (and computes the correct result in some rare cases). Fixes PR11086.
...
llvm-svn: 141441
2011-10-07 23:40:49 +00:00
Douglas Gregor
663c068d46
Add APInt support for converting to/from hexatridecimal strings
...
llvm-svn: 139695
2011-09-14 15:54:46 +00:00
Jeffrey Yasskin
7a16288157
Add APInt(numBits, ArrayRef<uint64_t> bigVal) constructor to prevent future ambiguity
...
errors like the one corrected by r135261. Migrate all LLVM callers of the old
constructor to the new one.
llvm-svn: 135431
2011-07-18 21:45:40 +00:00
Dylan Noblesmith
c8c184d2f8
unittests: add test for APInt::toString()
...
Follow up to r133032.
llvm-svn: 133107
2011-06-15 23:36:34 +00:00
Benjamin Kramer
09a51bab5d
Add an argument to APInt's magic udiv calculation to specify the number of bits that are known zero in the divided number.
...
This will come in handy soon.
llvm-svn: 127828
2011-03-17 20:39:06 +00:00
Cameron Zwarich
8731d0cc83
The signed version of our "magic number" computation for the integer approximation
...
of a constant had a minor typo introduced when copying it from the book, which
caused it to favor negative approximations over positive approximations in many
cases. Positive approximations require fewer operations beyond the multiplication.
In the case of division by 3, we still generate code that is a single instruction
larger than GCC's code.
llvm-svn: 126097
2011-02-21 00:22:02 +00:00
Jay Foad
25a5e4ca1f
PR5207: Rename overloaded APInt methods set(), clear(), flip() to
...
setAllBits(), setBit(unsigned), etc.
llvm-svn: 120564
2010-12-01 08:53:58 +00:00
Jakob Stoklund Olesen
e1e70b93ca
Attempt to unbreak the FreeBSD buildbot by XFAILing a unit test that seems to be
...
miscompiled by the system gcc-4.2.1
The test remains enabled for the second-stage test.
llvm-svn: 113824
2010-09-14 00:51:58 +00:00
Chandler Carruth
bc3e8a7c93
Switch from EXPECT_EQ({true,false, ...) to the more canonical
...
EXPECT_{TRUE,FALSE}(...) macros. This also prevents suprious warnings about
bool-to-pointer conversion that occurs withit EXPECT_EQ.
llvm-svn: 108248
2010-07-13 17:28:05 +00:00
Jeffrey Yasskin
b5cd01335b
Fix death tests in -Asserts builds.
...
llvm-svn: 98701
2010-03-17 01:18:45 +00:00
Duncan Sands
f7ad620c62
Pacify the compiler (signed with unsigned comparison) by making
...
these constants unsigned.
llvm-svn: 83962
2009-10-13 09:23:11 +00:00
Dan Gohman
c4e367b854
Add a ceilLogBase2 function to APInt.
...
llvm-svn: 83932
2009-10-13 01:49:02 +00:00
Daniel Dunbar
73e76a1d60
Fix a few more conversion warnings on 4.0
...
llvm-svn: 82232
2009-09-18 17:48:05 +00:00
Daniel Dunbar
0ec4ed7b74
Another try at fixing compile warnings on 4.0
...
llvm-svn: 82148
2009-09-17 17:46:53 +00:00
Daniel Dunbar
6ced391121
Attempt to fix some 4.0.0 build warnings.
...
llvm-svn: 81752
2009-09-14 02:38:53 +00:00
Daniel Dunbar
da30ecdcdd
Simplify, now that gtest supports raw_ostream directly.
...
llvm-svn: 81102
2009-09-06 02:31:26 +00:00
Chris Lattner
0ffe0e096d
split raw_os_ostream out to its own header and implementation file. This
...
means that raw_ostream no longer has to #include <iosfwd>. Nothing in llvm
should use raw_os_ostream.h, but llvm-gcc and some unit tests do.
llvm-svn: 79886
2009-08-24 04:02:06 +00:00
Daniel Dunbar
40b384eade
Unbreak unit tests.
...
llvm-svn: 79879
2009-08-24 02:02:58 +00:00
Bill Wendling
ef793ccbdc
Correct for recent assert change.
...
llvm-svn: 79601
2009-08-21 06:35:41 +00:00
Erick Tryzelaar
dadb1571b7
Fix bug with APInt::getBitsNeeded with for base 10 numbers 0-9.
...
llvm-svn: 79593
2009-08-21 03:15:28 +00:00
Erick Tryzelaar
1264bcb4de
Allow '+' to appear in APInt strings, and add more unit tests.
...
llvm-svn: 79592
2009-08-21 03:15:14 +00:00
Erick Tryzelaar
927191f179
Wrap unit test death tests in GTEST_HAS_DEATH_TEST
...
llvm-svn: 79218
2009-08-17 00:55:33 +00:00
Erick Tryzelaar
2b01eab81c
Add failure tests to APInt unit test.
...
llvm-svn: 79209
2009-08-16 23:36:01 +00:00
Daniel Dunbar
3a1efd11bb
Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.
...
- Patch by Erick Tryzelaar, with some edits (and a bug fix) from me.
llvm-svn: 78885
2009-08-13 02:33:34 +00:00
Dan Gohman
10f1733d9a
Reapply 74494, this time removing the conflicting definition of operator<<
...
in APIntTest.cpp.
llvm-svn: 74550
2009-06-30 20:10:56 +00:00
Chris Lattner
b869a0ade1
Fix PR4040: APInt's string constructor is too strict
...
patch by Jeff Yasskin!
llvm-svn: 70058
2009-04-25 18:34:04 +00:00
Misha Brukman
680336d12f
* Fixed calls to APInt ctor to work for negative values on Darwin/x86
...
* Converted C-style casts to C++-style casts
llvm-svn: 68613
2009-04-08 16:17:23 +00:00
Misha Brukman
d1d2c50ea7
Converted a1.ll to unittests.
...
llvm-svn: 67652
2009-03-24 21:36:09 +00:00
Misha Brukman
5182b758a0
Renamed unittest files to have a consistent {Tt}est suffix.
...
llvm-svn: 67326
2009-03-19 19:09:48 +00:00