summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-071-74/+68
| | | | | | | | zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method trunc(), to be const and to return a new value instead of modifying the object in place. llvm-svn: 121120
* APInt: microoptimize a few methods.Benjamin Kramer2010-12-041-4/+0
| | | | llvm-svn: 120912
* PR5207: Rename overloaded APInt methods set(), clear(), flip() toJay Foad2010-12-011-13/+13
| | | | | | setAllBits(), setBit(unsigned), etc. llvm-svn: 120564
* PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.Jay Foad2010-11-301-6/+3
| | | | llvm-svn: 120413
* Bounds-check APInt's operator[].Dan Gohman2010-11-181-0/+1
| | | | llvm-svn: 119708
* fix a bug I introduced, no idea how this didn't repro right.Chris Lattner2010-10-141-2/+2
| | | | llvm-svn: 116462
* add uadd_ov/usub_ov to apint, consolidate constant foldingChris Lattner2010-10-141-0/+12
| | | | | | | | | logic to use the new APInt methods. Among other things this implements rdar://8501501 - llvm.smul.with.overflow.i32 should constant fold which comes from "clang -ftrapv", originally brought to my attention from PR8221. llvm-svn: 116457
* constify these methods.Chris Lattner2010-10-131-5/+5
| | | | llvm-svn: 116455
* add a few operations for signed operations that also Chris Lattner2010-10-131-0/+46
| | | | | | return an overflow flag. llvm-svn: 116452
* stomp some more undefined behavior, PR7775.Chris Lattner2010-08-181-6/+7
| | | | llvm-svn: 111337
* Don't pass StringRef by reference.Benjamin Kramer2010-07-141-3/+3
| | | | llvm-svn: 108366
* improve portability to systems that don't have round, patch byChris Lattner2010-05-151-4/+3
| | | | | | Evzen Muller! llvm-svn: 103877
* improve portability to minix, patch by Chris Lattner2010-03-261-2/+2
| | | | | | Kees van Reeuwijk for PR6704 llvm-svn: 99677
* Fix minor style issues.Dan Gohman2010-03-241-38/+37
| | | | llvm-svn: 99414
* Teach APFloat how to create both QNaNs and SNaNs and with arbitrary-widthJohn McCall2010-02-281-1/+9
| | | | | | | | payloads. APFloat's internal folding routines always make QNaNs now, instead of sometimes making QNaNs and sometimes SNaNs depending on the type. llvm-svn: 97364
* Fix "the the" and similar typos.Dan Gohman2010-02-101-2/+2
| | | | llvm-svn: 95781
* Make APInt::countLeadingZerosSlowCase() treat the contents of padding bitsJohn McCall2010-02-031-6/+18
| | | | | | as undefined. Fixes an assertion in APFloat::toString noticed by Dale. llvm-svn: 95196
* Change errs() to dbgs().David Greene2010-01-051-34/+34
| | | | llvm-svn: 92643
* Set Remainder before Quotient in case Quotient and LHS alias. The newJohn McCall2009-12-241-1/+1
| | | | | | order should be immune to such problems. llvm-svn: 92124
* Tabs -> spaces, and remove trailing whitespace.Daniel Dunbar2009-09-201-1/+1
| | | | llvm-svn: 82355
* Remove some unused variables and methods warned about byDuncan Sands2009-09-061-2/+0
| | | | | | icc (#177, partial). Patch by Erick Tryzelaar. llvm-svn: 81106
* remove the dead std::ostream APInt inserterChris Lattner2009-08-231-8/+2
| | | | llvm-svn: 79875
* Clean up the APInt function getDigit.Erick Tryzelaar2009-08-211-21/+19
| | | | llvm-svn: 79602
* Update error messages for '+'. Fix grammar and make the twoEric Christopher2009-08-211-4/+5
| | | | | | negative checks resemble each other. llvm-svn: 79595
* Fix trailing whitespace and 80-col violation.Eric Christopher2009-08-211-120/+121
| | | | llvm-svn: 79594
* Fix bug with APInt::getBitsNeeded with for base 10 numbers 0-9.Erick Tryzelaar2009-08-211-30/+42
| | | | llvm-svn: 79593
* Allow '+' to appear in APInt strings, and add more unit tests.Erick Tryzelaar2009-08-211-6/+11
| | | | llvm-svn: 79592
* Switch to SmallString::str from SmallString::c_str, and removeDaniel Dunbar2009-08-191-3/+4
| | | | | | SmallString::c_str. llvm-svn: 79456
* Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.Daniel Dunbar2009-08-131-17/+22
| | | | | | - Patch by Erick Tryzelaar, with some edits (and a bug fix) from me. llvm-svn: 78885
* Add attempted idiotproofing comment per review.Dale Johannesen2009-08-121-1/+2
| | | | llvm-svn: 78825
* Fix a nondeterministic bug in APInt::roundToDouble;Dale Johannesen2009-08-121-2/+2
| | | | | | | | when !isSingleWord() but getActiveBits() is small, we were using the pointer value instead of the low word of the integer value. llvm-svn: 78821
* llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.Torok Edwin2009-07-141-4/+4
| | | | | | | | | 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
* Switch to raw_ostream.Daniel Dunbar2009-07-131-35/+35
| | | | llvm-svn: 75451
* assert(0) -> LLVM_UNREACHABLE.Torok Edwin2009-07-111-4/+5
| | | | | | | | | 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
* Reapply 74494, this time removing the conflicting definition of operator<<Dan Gohman2009-06-301-0/+6
| | | | | | in APIntTest.cpp. llvm-svn: 74550
* Temporarily revert r74494. It was causing failures in the unit tests.Bill Wendling2009-06-301-6/+0
| | | | llvm-svn: 74515
* Define an operator<< for APInt to be used with std::ostream.Dan Gohman2009-06-301-0/+6
| | | | | | | This will allow it to be used in unittests that use gtest's EXPECT_EQ. llvm-svn: 74494
* 80 column violation.Evan Cheng2009-05-211-1/+1
| | | | llvm-svn: 72235
* Fix whitespacing (space after switch).Mike Stump2009-05-131-6/+5
| | | | llvm-svn: 71738
* Move helper functions for optimizing division by constant into the APIntJay Foad2009-04-301-0/+92
| | | | | | class. llvm-svn: 70488
* Fix PR4040: APInt's string constructor is too strictChris Lattner2009-04-251-7/+9
| | | | | | patch by Jeff Yasskin! llvm-svn: 70058
* Use CHAR_BIT instead of hard-coding 8 in several places where itDan Gohman2009-04-011-3/+3
| | | | | | | is appropriate. This helps visually differentiate host-oriented calculations from target-oriented calculations. llvm-svn: 68227
* Fix comment typo.Duncan Sands2009-03-191-1/+1
| | | | llvm-svn: 67302
* Fix a hashing bug in APInt. A certain pathological testcase (tooStuart Hastings2009-03-131-7/+85
| | | | | | | | | | | | large for the testsuite) took over six minutes to compile on my Mac. The patched LLVM-GCC compiles that testcase in three seconds (GCC takes less than one second). This hash function is more complex (about 35 instructions on x86) than what Chris wanted, but I expect it will be well-behaved with arbitrary inputs. Thank you to everyone who responded to my previous request for advice. llvm-svn: 66962
* APInt's countLeadingOnes() was broken for negative i128 values,Torok Edwin2009-01-271-1/+7
| | | | | | | | | causing assertion failures in getSExtValue(). Fix it by making highWordBits actually contain what its name says, and add some more unit-tests for APInt. This fixes PR3419. llvm-svn: 63107
* Remove uses of uint32_t in favor of 'unsigned' for better Chris Lattner2009-01-211-193/+193
| | | | | | compatibility with cygwin. Patch by Jay Foad! llvm-svn: 62695
* Fix typo, sentence fragment.Nick Lewycky2009-01-191-2/+2
| | | | llvm-svn: 62512
* rearrange some code.Chris Lattner2008-10-111-6/+6
| | | | llvm-svn: 57384
* Switch the asmprinter (.ll) and all the stuff it requires over toChris Lattner2008-08-231-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | use raw_ostream instead of std::ostream. Among other goodness, this speeds up llvm-dis of kc++ with a release build from 0.85s to 0.49s (88% faster). Other interesting changes: 1) This makes Value::print be non-virtual. 2) AP[S]Int and ConstantRange can no longer print to ostream directly, use raw_ostream instead. 3) This fixes a bug in raw_os_ostream where it didn't flush itself when destroyed. 4) This adds a new SDNode::print method, instead of only allowing "dump". A lot of APIs have both std::ostream and raw_ostream versions, it would be useful to go through and systematically anihilate the std::ostream versions. This passes dejagnu, but there may be minor fallout, plz let me know if so and I'll fix it. llvm-svn: 55263
* Move the fast-path (<=i64) cases of various APInt methods inlineChris Lattner2008-08-201-150/+40
| | | | | | | and the slow-path cases out of line. This speeds up instcombine a bit in real world cases. Patch contributed by m-s. llvm-svn: 55063
OpenPOWER on IntegriCloud