[PATCH] D35192: [ARM] Use ADDCARRY / SUBCARRY

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 12:51:55 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:4011
+        DAG.getNode(ARMISD::SUBE, dl, VTs, DAG.getConstant(1, dl, MVT::i32),
+                    DAG.getConstant(0, dl, MVT::i32), Carry);
+    break;
----------------
Oops, I should have spotted the issue here earlier.

The value produced by sbc is a+~b+C. So (ARMISD::SUBE i32 1, i32 0) is computing 1+-1+C==C. The value you actually need to produce here is 1-C.

In practice, this means we're generating wrong code for the usub_overflow testcase.


https://reviews.llvm.org/D35192





More information about the llvm-commits mailing list