[PATCH] D62266: [DAGCombine][X86][AArch64][ARM] (C - x) + y -> (y - x) + C fold

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 01:51:17 PDT 2019


lebedev.ri added a comment.

In D62266#1512853 <https://reviews.llvm.org/D62266#1512853>, @efriedma wrote:

> uaddo+subcarry doesn't really work the way you'd want it to on ARM... I think you have to invert the carry bit, and there isn't any convenient way to do that.  (Note the extra "SUB" between the ARMISD::ADDE and the ARMISD::SUBC.) So I think to get the optimal code here you have to produce neg+addcarry instead of subcarry.


Hmm. I'm sorry, that did not make the problem any clearer to me.
Sadly, i have literally never encountered 'carry' before, so this makes very little sense to me.
Are you saying that the following transform should be performed: `(sub Carry, X)` -> `(addcarry (sub 0, X), 0, !Carry)`?
That regresses the test even further..


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62266





More information about the llvm-commits mailing list