[PATCH] D125130: [CodeGen] Clarify the semantics of ADDCARRY/SUBCARRY

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 13:58:29 PDT 2022


kazu created this revision.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch clarifies the semantics of ADDCARRY/SUBCARRY, specifically
stating that both the incoming and outgoing carries are active high.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125130

Files:
  llvm/include/llvm/CodeGen/ISDOpcodes.h


Index: llvm/include/llvm/CodeGen/ISDOpcodes.h
===================================================================
--- llvm/include/llvm/CodeGen/ISDOpcodes.h
+++ llvm/include/llvm/CodeGen/ISDOpcodes.h
@@ -284,9 +284,12 @@
   /// rhs to the add or sub, and the third is a boolean indicating if there
   /// is an incoming carry. These nodes produce two results: the normal
   /// result of the add or sub, and the output carry so they can be chained
-  /// together. The use of this opcode is preferable to adde/sube if the
-  /// target supports it, as the carry is a regular value rather than a
-  /// glue, which allows further optimisation.
+  /// together. Both the incoming and outgoing carries are active high with 1
+  /// indicating the presence of a carry/borrow. Care should be taken on those
+  /// hardware architectures where some instructions use the active-low logic
+  /// for the carry/borrow flag. The use of this opcode is preferable to
+  /// adde/sube if the target supports it, as the carry is a regular value
+  /// rather than a glue, which allows further optimisation.
   ADDCARRY,
   SUBCARRY,
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125130.427736.patch
Type: text/x-patch
Size: 1121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220506/1548be41/attachment.bin>


More information about the llvm-commits mailing list