[LegalizeTypes] Add a special case for (add X, 1) to ExpandIntRes_ADDSUB.
authorCraig Topper <craig.topper@sifive.com>
Thu, 23 Feb 2023 17:47:42 +0000 (09:47 -0800)
committerCraig Topper <craig.topper@sifive.com>
Thu, 23 Feb 2023 17:47:42 +0000 (09:47 -0800)
commit230e61658b5e5c91f631459511f0efb4b15f8c77
tree1f513ce81900c8c3c83b2d43ddccab649d0392e1
parent1b72a32762436aad1b7064a8d44681300fd8e380
[LegalizeTypes] Add a special case for (add X, 1) to ExpandIntRes_ADDSUB.

On targets without ADDCARRY or ADDE, we need to emit a separate
SETCC to determine carry from the low half to the high half. Usually
we do (setult Lo, LHSLo). If RHSLo is 1 we can instead do (seteq Lo, 0).
This can reduce the live range of LHSLo.
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/test/CodeGen/RISCV/alu64.ll
llvm/test/CodeGen/RISCV/atomicrmw-uinc-udec-wrap.ll
llvm/test/CodeGen/RISCV/branch-on-zero.ll
llvm/test/CodeGen/RISCV/forced-atomics.ll
llvm/test/CodeGen/RISCV/overflow-intrinsics.ll
llvm/test/CodeGen/RISCV/xaluo.ll