[all-commits] [llvm/llvm-project] 2fc5a5: [LegalizeTypes][RISCV] Add a special case to Expan...

Craig Topper via All-commits all-commits at lists.llvm.org
Thu Feb 23 09:17:11 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2fc5a5117c613b580be321187555976e4e60872e
      https://github.com/llvm/llvm-project/commit/2fc5a5117c613b580be321187555976e4e60872e
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-02-23 (Thu, 23 Feb 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
    M llvm/test/CodeGen/RISCV/overflow-intrinsics.ll
    M llvm/test/CodeGen/RISCV/xaluo.ll

  Log Message:
  -----------
  [LegalizeTypes][RISCV] Add a special case to ExpandIntRes_UADDSUBO for (uaddo X, 1).

On targets that lack ADDCARRY support we split a wide uaddo into
an ADD and a SETCC that both need to be split.

For (uaddo X, 1) we can observe that when the add overflows the result
will be 0. We can emit (seteq (or Lo, Hi), 0) to detect this.

This improves D142071.

There is an alternative here. We could use either ~(lo(X) & hi(X)) == 0 or
(lo(X) & hi(X)) == -1 before the addition. That would be closer to the
code before D142071.

Reviewed By: liaolucy

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




More information about the All-commits mailing list