summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a crash in APInt::lshr when shiftAmt > BitWidth.Chad Rosier2012-06-081-1/+1
| | | | | | Patch by James Benton <jbenton@vmware.com>. llvm-svn: 158213
* Move APInt::operator[] inline.Benjamin Kramer2012-03-141-6/+0
| | | | llvm-svn: 152692
* Move APInt::operator! inline, it's small and fuses well with surrounding ↵Benjamin Kramer2012-03-141-10/+0
| | | | | | code when inlined. llvm-svn: 152688
* Inline a trivial helper function.Benjamin Kramer2012-03-121-7/+3
| | | | llvm-svn: 152577
* Replace a hand-coded leading one counting loop with the magic from MathExtras.h.Benjamin Kramer2012-03-111-8/+1
| | | | llvm-svn: 152545
* Replace the hashing functions on APInt and APFloat with overloads of theChandler Carruth2012-03-041-87/+6
| | | | | | | | | | | | | | new hash_value infrastructure, and replace their implementations using hash_combine. This removes a complete copy of Jenkin's lookup3 hash function (which is both significantly slower and lower quality than the one implemented in hash_combine) along with a somewhat scary xor-only hash function. Now that APInt and APFloat can be passed directly to hash_combine, simplify the rest of the LLVMContextImpl hashing to use the new infrastructure. llvm-svn: 152004
* Fix undefined behavior.Ahmed Charles2012-02-241-1/+1
| | | | llvm-svn: 151385
* Add r149110 back with a fix for when the vector and the int have the sameRafael Espindola2012-01-271-0/+12
| | | | | | width. llvm-svn: 149151
* Fix APInt::rotl and APInt::rotr so that they work correctly. Found while ↵Eli Friedman2011-12-221-12/+4
| | | | | | writing some code that tried to use them. llvm-svn: 147134
* APInt: update asserts for base-36Dylan Noblesmith2011-12-161-1/+5
| | | | | | | | Hexatridecimal was added in r139695. And fix the unittest that now triggers the assert. llvm-svn: 146754
* Fix unreachable return & simplify some branches.David Blaikie2011-12-011-9/+5
| | | | llvm-svn: 145627
* Correctly byte-swap APInts with bit-widths greater than 64.Richard Smith2011-11-231-17/+26
| | | | llvm-svn: 145111
* Fix APInt::operator*= so that it computes the correct result for large ↵Eli Friedman2011-10-071-1/+2
| | | | | | 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
* U is good enoughDouglas Gregor2011-09-201-2/+2
| | | | llvm-svn: 140166
* Eliminate sign-comparison warnings in APIntDouglas Gregor2011-09-201-2/+4
| | | | llvm-svn: 140158
* Silence -Wsign-compare warnings from GCC.Benjamin Kramer2011-09-191-2/+2
| | | | llvm-svn: 140043
* Add APInt support for converting to/from hexatridecimal stringsDouglas Gregor2011-09-141-12/+19
| | | | llvm-svn: 139695
* Add APInt(numBits, ArrayRef<uint64_t> bigVal) constructor to prevent future ↵Jeffrey Yasskin2011-07-181-6/+14
| | | | | | | | | ambiguity errors like the one corrected by r135261. Migrate all LLVM callers of the old constructor to the new one. llvm-svn: 135431
* add option for literal formatting to APInt::toString()Ted Kremenek2011-06-151-3/+34
| | | | | | | | | | | | | | | toString() now takes an optional bool argument that, depending on the radix, adds the appropriate prefix to the integer's string representation that makes it into a meaningful C literal, e.g.: hexademical: '-f' becomes '-0xf' octal: '77' becomes '077' binary: '110' becomes '0b110' Patch by nobled@dreamwidth.org! llvm-svn: 133032
* fix a bug for hosts without round, PR8893.Chris Lattner2011-05-221-1/+1
| | | | llvm-svn: 131842
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* Constant folding support for calls to umul.with.overflow(), basically ↵Frits van Bommel2011-03-271-0/+10
| | | | | | identical to the smul.with.overflow() code. llvm-svn: 128379
* Add an argument to APInt's magic udiv calculation to specify the number of ↵Benjamin Kramer2011-03-171-2/+4
| | | | | | | | bits that are known zero in the divided number. This will come in handy soon. llvm-svn: 127828
* The signed version of our "magic number" computation for the integer ↵Cameron Zwarich2011-02-211-1/+1
| | | | | | | | | | | | | 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
* 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
OpenPOWER on IntegriCloud