[PATCH] D64213: [SystemZ] Fix addcarry of usubo (PR42512)

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 10:06:11 PDT 2019


uweigand added a comment.

Unfortunately, I think this gets the semantics wrong, because "carry" and "borrow" use *different* CC values on SystemZ.

In your example,

  slgfi %r0, 1

will set CC 1 if an overflow ("borrow") happened, and CC 2 or 3 if no overflow happened.
But the next instruction,

  alcr %r2, %r0

will interpret CC [0 and] 1 as *no* carry to be added, and CC 2 and 3 as carry.

This seems a rather unusual case anyway, can we simply always fall back to the default expansion if the source of the overflow doesn't match the current instruction?  I.e. a ISD::ADDCARRY may take its overflow value from a ISD::UADDO or another ISD::ADDCARRY, and a ISD::SUBCARRY may take its overflow value from a ISD::USUBO or another ISD::SUBCARRY, but everything else gets the default expansion?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64213/new/

https://reviews.llvm.org/D64213





More information about the llvm-commits mailing list