]> granicus.if.org Git - llvm/commit
[KnownBits] Add computeForAddCarry()
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 12 Apr 2019 18:18:08 +0000 (18:18 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 12 Apr 2019 18:18:08 +0000 (18:18 +0000)
commit6c48db936002f7e3dda3e29fe2a3d66890775e03
tree9b4aa18f72104c328cc6008d767ace1408d0d9d6
parentbfc681fbdbdd4eb48ef7fb810e0d9d0e2c98a6dd
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358297 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/KnownBits.h
lib/Support/KnownBits.cpp
unittests/Support/CMakeLists.txt
unittests/Support/KnownBitsTest.cpp [new file with mode: 0644]