diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-12 18:18:08 +0000 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-04-12 18:18:08 +0000 |
| commit | 7671fc71f62a7387c06742c569fe17608796e8f2 (patch) | |
| tree | c219b1b1ed382fe7fe62a2470cbbffe205b89b9a /llvm/include | |
| parent | 7a60cd38af5563ebe4efa6f1544dca5a5ebebbee (diff) | |
| download | bcm5719-llvm-7671fc71f62a7387c06742c569fe17608796e8f2.tar.gz bcm5719-llvm-7671fc71f62a7387c06742c569fe17608796e8f2.zip | |
[KnownBits] Add computeForAddCarry()
This is for D60460. computeForAddSub() essentially already supports
carries because it has to deal with subtractions. This revision
extracts a lower-level computeForAddCarry() function, which allows
computing the known bits for add (carry known zero), sub (carry known
one) and addcarry (carry unknown).
As we don't seem to have any yet, I've added a unit test file for
KnownBits and exhaustive tests for the new computeForAddCarry()
functionality, as well the existing computeForAddSub() function.
Differential Revision: https://reviews.llvm.org/D60522
llvm-svn: 358297
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Support/KnownBits.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/KnownBits.h b/llvm/include/llvm/Support/KnownBits.h index ed32cd2b576..07fd94e29a1 100644 --- a/llvm/include/llvm/Support/KnownBits.h +++ b/llvm/include/llvm/Support/KnownBits.h @@ -202,6 +202,10 @@ public: return getBitWidth() - Zero.countPopulation(); } + /// Compute known bits resulting from adding LHS, RHS and a 1-bit Carry. + static KnownBits computeForAddCarry( + const KnownBits &LHS, const KnownBits &RHS, const KnownBits &Carry); + /// Compute known bits resulting from adding LHS and RHS. static KnownBits computeForAddSub(bool Add, bool NSW, const KnownBits &LHS, KnownBits RHS); |

