summaryrefslogtreecommitdiff
path: root/lib/Support/APInt.cpp
Commit message (Collapse)AuthorAge
* Fix known typosAlp Toker2014-01-24
| | | | | | | Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200018 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove APInt::extractBit since it is already implemented via operator[]. ↵Michael Gottesman2013-12-13
| | | | | | Change tests for extractBit to test operator[]. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197277 91177308-0d34-0410-b5e6-96231b3b80d8
* [block-freq] Add the APInt method extractBit.Michael Gottesman2013-12-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197271 91177308-0d34-0410-b5e6-96231b3b80d8
* APInt: Simplify code. No functionality change.Benjamin Kramer2013-06-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183073 91177308-0d34-0410-b5e6-96231b3b80d8
* [APInt] Implement tcDecrement as a counterpart to tcIncrement. This is for ↵Michael Gottesman2013-05-28
| | | | | | | | use in APFloat IEEE-754R 2008 nextUp/nextDown function. rdar://13852078 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182801 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.Michael J. Spencer2013-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182680 91177308-0d34-0410-b5e6-96231b3b80d8
* Use pre-inc, pre-dec when possible.Jakub Staszak2013-03-20
| | | | | | | They are generally faster (at least not slower) than post-inc, post-dec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177608 91177308-0d34-0410-b5e6-96231b3b80d8
* Move part of APInt implementation from header to cpp file. These methodsJakub Staszak2013-02-20
| | | | | | | | require call cpp file anyway, so we wouldn't gain anything by keeping them inline. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175579 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-27
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164768 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164767 91177308-0d34-0410-b5e6-96231b3b80d8
* PR13326: Fix a subtle edge case in the udiv -> magic multiply generator.Benjamin Kramer2012-07-11
| | | | | | This caused 6 of 65k possible 8 bit udivs to be wrong. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160058 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash in APInt::lshr when shiftAmt > BitWidth.Chad Rosier2012-06-08
| | | | | | | Patch by James Benton <jbenton@vmware.com>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158213 91177308-0d34-0410-b5e6-96231b3b80d8
* Move APInt::operator[] inline.Benjamin Kramer2012-03-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152692 91177308-0d34-0410-b5e6-96231b3b80d8
* Move APInt::operator! inline, it's small and fuses well with surrounding ↵Benjamin Kramer2012-03-14
| | | | | | code when inlined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152688 91177308-0d34-0410-b5e6-96231b3b80d8
* Inline a trivial helper function.Benjamin Kramer2012-03-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152577 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace a hand-coded leading one counting loop with the magic from MathExtras.h.Benjamin Kramer2012-03-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152545 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace the hashing functions on APInt and APFloat with overloads of theChandler Carruth2012-03-04
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152004 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix undefined behavior.Ahmed Charles2012-02-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151385 91177308-0d34-0410-b5e6-96231b3b80d8
* Add r149110 back with a fix for when the vector and the int have the sameRafael Espindola2012-01-27
| | | | | | width. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149151 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix APInt::rotl and APInt::rotr so that they work correctly. Found while ↵Eli Friedman2011-12-22
| | | | | | writing some code that tried to use them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147134 91177308-0d34-0410-b5e6-96231b3b80d8
* APInt: update asserts for base-36Dylan Noblesmith2011-12-16
| | | | | | | | Hexatridecimal was added in r139695. And fix the unittest that now triggers the assert. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146754 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix unreachable return & simplify some branches.David Blaikie2011-12-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145627 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly byte-swap APInts with bit-widths greater than 64.Richard Smith2011-11-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145111 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix APInt::operator*= so that it computes the correct result for large ↵Eli Friedman2011-10-07
| | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141441 91177308-0d34-0410-b5e6-96231b3b80d8
* U is good enoughDouglas Gregor2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140166 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate sign-comparison warnings in APIntDouglas Gregor2011-09-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140158 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence -Wsign-compare warnings from GCC.Benjamin Kramer2011-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140043 91177308-0d34-0410-b5e6-96231b3b80d8
* Add APInt support for converting to/from hexatridecimal stringsDouglas Gregor2011-09-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139695 91177308-0d34-0410-b5e6-96231b3b80d8
* Add APInt(numBits, ArrayRef<uint64_t> bigVal) constructor to prevent future ↵Jeffrey Yasskin2011-07-18
| | | | | | | | | ambiguity errors like the one corrected by r135261. Migrate all LLVM callers of the old constructor to the new one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135431 91177308-0d34-0410-b5e6-96231b3b80d8
* add option for literal formatting to APInt::toString()Ted Kremenek2011-06-15
| | | | | | | | | | | | | | | 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133032 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a bug for hosts without round, PR8893.Chris Lattner2011-05-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131842 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-15
| | | | | | | | Luis Felipe Strano Moraes! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
* Constant folding support for calls to umul.with.overflow(), basically ↵Frits van Bommel2011-03-27
| | | | | | identical to the smul.with.overflow() code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128379 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an argument to APInt's magic udiv calculation to specify the number of ↵Benjamin Kramer2011-03-17
| | | | | | | | bits that are known zero in the divided number. This will come in handy soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127828 91177308-0d34-0410-b5e6-96231b3b80d8
* The signed version of our "magic number" computation for the integer ↵Cameron Zwarich2011-02-21
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126097 91177308-0d34-0410-b5e6-96231b3b80d8
* PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() andJay Foad2010-12-07
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
* APInt: microoptimize a few methods.Benjamin Kramer2010-12-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120912 91177308-0d34-0410-b5e6-96231b3b80d8
* PR5207: Rename overloaded APInt methods set(), clear(), flip() toJay Foad2010-12-01
| | | | | | setAllBits(), setBit(unsigned), etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120564 91177308-0d34-0410-b5e6-96231b3b80d8
* PR5207: Make APInt::set(), APInt::clear() and APInt::flip() return void.Jay Foad2010-11-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120413 91177308-0d34-0410-b5e6-96231b3b80d8
* Bounds-check APInt's operator[].Dan Gohman2010-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119708 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a bug I introduced, no idea how this didn't repro right.Chris Lattner2010-10-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116462 91177308-0d34-0410-b5e6-96231b3b80d8
* add uadd_ov/usub_ov to apint, consolidate constant foldingChris Lattner2010-10-14
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116457 91177308-0d34-0410-b5e6-96231b3b80d8
* constify these methods.Chris Lattner2010-10-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116455 91177308-0d34-0410-b5e6-96231b3b80d8
* add a few operations for signed operations that also Chris Lattner2010-10-13
| | | | | | | return an overflow flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116452 91177308-0d34-0410-b5e6-96231b3b80d8
* stomp some more undefined behavior, PR7775.Chris Lattner2010-08-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111337 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't pass StringRef by reference.Benjamin Kramer2010-07-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108366 91177308-0d34-0410-b5e6-96231b3b80d8
* improve portability to systems that don't have round, patch byChris Lattner2010-05-15
| | | | | | | Evzen Muller! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103877 91177308-0d34-0410-b5e6-96231b3b80d8
* improve portability to minix, patch by Chris Lattner2010-03-26
| | | | | | | Kees van Reeuwijk for PR6704 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99677 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix minor style issues.Dan Gohman2010-03-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99414 91177308-0d34-0410-b5e6-96231b3b80d8