Michael Gottesman
2a51955f08
[APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for use in APFloat IEEE-754R 2008 nextUp/nextDown function.
...
rdar://13852078
llvm-svn: 182801
2013-05-28 19:50:20 +00:00
Benjamin Kramer
a2f37d8d3b
Move the SplatByte helper to APInt and generalize it a bit.
...
llvm-svn: 175621
2013-02-20 13:00:06 +00:00
Meador Inge
58a7392486
ADT: Correct APInt::getActiveWords for zero values
...
PR15138 was opened because of a segfault in the Bitcode writer.
The actual issue ended up being a bug in APInt where calls to
APInt::getActiveWords returns a bogus value when the APInt value
is 0. This patch fixes the problem by ensuring that getActiveWords
returns 1 for 0 valued APInts.
llvm-svn: 174641
2013-02-07 18:36:50 +00:00
Chandler Carruth
f413c260cc
Sort the #include lines for unittest/...
...
llvm-svn: 169250
2012-12-04 10:23:08 +00:00
Nuno Lopes
328f9efec2
fix the quotient returned by sdivrem() for the case when LHS is negative and RHS is positive
...
based on a patch by Preston Briggs, with some modifications
llvm-svn: 157231
2012-05-22 01:09:48 +00:00
Benjamin Kramer
6d9863be3a
Add a unittest for rotating a really big APInt.
...
Clang miscompiles it under certain circumstances, and it's a good exercise for APInt.
llvm-svn: 149986
2012-02-07 16:27:39 +00:00
Eli Friedman
41be35819d
Some unittests for APInt rotates; patch by Cameron McInally.
...
llvm-svn: 147186
2011-12-22 22:11:19 +00:00
Dylan Noblesmith
91b9af8f44
APInt: update asserts for base-36
...
Hexatridecimal was added in r139695.
And fix the unittest that now triggers the assert.
llvm-svn: 146754
2011-12-16 20:36:31 +00:00
Eli Friedman
433785c651
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
8c0777c5f3
Add APInt support for converting to/from hexatridecimal strings
...
llvm-svn: 139695
2011-09-14 15:54:46 +00:00
Jeffrey Yasskin
2e0f2a0985
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
b75ad906fa
unittests: add test for APInt::toString()
...
Follow up to r133032.
llvm-svn: 133107
2011-06-15 23:36:34 +00:00
Benjamin Kramer
a85996c235
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
b7e676db6c
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
789e8ac4f7
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
0a9b86f575
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
e3d4a2cbbc
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
4443f00d2b
Fix death tests in -Asserts builds.
...
llvm-svn: 98701
2010-03-17 01:18:45 +00:00
Duncan Sands
19c1644f1f
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
f9067da535
Add a ceilLogBase2 function to APInt.
...
llvm-svn: 83932
2009-10-13 01:49:02 +00:00
Daniel Dunbar
d4df08bb72
Fix a few more conversion warnings on 4.0
...
llvm-svn: 82232
2009-09-18 17:48:05 +00:00
Daniel Dunbar
b415837d62
Another try at fixing compile warnings on 4.0
...
llvm-svn: 82148
2009-09-17 17:46:53 +00:00
Daniel Dunbar
23724b98d0
Attempt to fix some 4.0.0 build warnings.
...
llvm-svn: 81752
2009-09-14 02:38:53 +00:00
Daniel Dunbar
7ef30987f7
Simplify, now that gtest supports raw_ostream directly.
...
llvm-svn: 81102
2009-09-06 02:31:26 +00:00
Chris Lattner
98f201632e
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
56712ba250
Unbreak unit tests.
...
llvm-svn: 79879
2009-08-24 02:02:58 +00:00
Bill Wendling
e5dbd6b0f9
Correct for recent assert change.
...
llvm-svn: 79601
2009-08-21 06:35:41 +00:00
Erick Tryzelaar
ff8b504eb3
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
11660bb729
Allow '+' to appear in APInt strings, and add more unit tests.
...
llvm-svn: 79592
2009-08-21 03:15:14 +00:00
Erick Tryzelaar
3ca0a7b0e4
Wrap unit test death tests in GTEST_HAS_DEATH_TEST
...
llvm-svn: 79218
2009-08-17 00:55:33 +00:00
Erick Tryzelaar
36d9dbb8a1
Add failure tests to APInt unit test.
...
llvm-svn: 79209
2009-08-16 23:36:01 +00:00
Daniel Dunbar
3a5a25d5d5
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
148d3bb9b4
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
d68b203337
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
56dff472d2
* 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
6e86395ae7
Converted a1.ll to unittests.
...
llvm-svn: 67652
2009-03-24 21:36:09 +00:00
Misha Brukman
3c59ac1164
Renamed unittest files to have a consistent {Tt}est suffix.
...
llvm-svn: 67326
2009-03-19 19:09:48 +00:00