]> granicus.if.org Git - llvm/commit
[ARM] Use ADDCARRY / SUBCARRY
authorRoger Ferrer Ibanez <roger.ferreribanez@arm.com>
Thu, 3 Aug 2017 07:45:10 +0000 (07:45 +0000)
committerRoger Ferrer Ibanez <roger.ferreribanez@arm.com>
Thu, 3 Aug 2017 07:45:10 +0000 (07:45 +0000)
commit0e06563a628c15465f596f793bc008720830c5a7
treee8e3b6bb36644676ebd10288e94139f91de05d86
parentdfd6a10efb6d20ab543db8769d89ccbb1663de45
[ARM] Use ADDCARRY / SUBCARRY

This patch:

- makes nodes ISD::ADDCARRY and ISD::SUBCARRY legal for i32
- lowering is done by first converting the boolean value into the carry flag
  using (_, C) <- (ARMISD::ADDC R, -1) and converted back to an integer value
  using (R, _) <- (ARMISD::ADDE 0, 0, C). An ARMISD::ADDE between the two
  operations does the actual addition.
- for subtraction, given that ISD::SUBCARRY second result is actually a
  borrow, we need to invert the value of the second operand and result before
  and after using ARMISD::SUBE. We need to invert the carry result of
  ARMISD::SUBE to preserve the semantics.
- given that the generic combiner may lower ISD::ADDCARRY and
  ISD::SUBCARRY into ISD::UADDO and ISD::USUBO we need to update their lowering
  as well otherwise i64 operations now would require branches. This implies
  updating the corresponding test for unsigned.
- add new combiner to remove the redundant conversions from/to carry flags
  to/from boolean values (ARMISD::ADDC (ARMISD::ADDE 0, 0, C), -1) -> C

Differential Revision: https://reviews.llvm.org/D35192

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309923 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMISelLowering.h
test/CodeGen/ARM/intrinsics-overflow.ll