This patch clarifies the semantics of ADDCARRY/SUBCARRY, specifically
stating that both the incoming and outgoing carries are active high.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I don't think most people are going to be familiar with "active high"/"active low" terminology. At least, I had to look it up.
I think it makes sense to:
- Explicitly mention the relationship with UADDO/USUBO.
- Explicitly call out that for subtraction, the native carry flag is the inverse of what USUBO produces.
What is meant by "native carry flag" here? X86's carry flag matches the USUBO output.
I wonder if the use of the word "carry" on subtract is misleading. Should it be "borrow" instead?
What is meant by "native carry flag" here? X86's carry flag matches the USUBO output.
Sorry, missed a few words. Meant to say "Explicitly call out that for subtraction, on many targets, the native carry flag is the inverse of what USUBO produces." x86 is not one of those targets. AArch64 is.
Included a comparison to [US]{ADD,SUB}O.
Split the description to several paragraphs, separating the definition
proper and supplemental information.
OK. I've replaced them with "if and only if" phrases.
I think it makes sense to:
- Explicitly mention the relationship with UADDO/USUBO.
- Explicitly call out that for subtraction, the native carry flag is the inverse of what USUBO produces.
I am not sure if the latest revision addresses your comment about UADD/USUBO. If not, I'd like to drop the last paragraph about [US]{ADD,SUB}O and check in the rest. I think it's important to check in the precise definition first. We can always add supplemental information later. Thanks!
The reason I mention UADDO/USUBO is because that's what we use to represent the initial operation, usually. If you think it's not important, we can leave that bit out.
llvm/include/llvm/CodeGen/ISDOpcodes.h | ||
---|---|---|
296 | Should this be "add/sub" to match the order of "carry/borrow" used? |
Should this be "add/sub" to match the order of "carry/borrow" used?