[PATCH] D29872: Do not legalize large add with addc/adde, introduce addcarry and do it with uaddo/addcarry
James Y Knight via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 14:32:09 PST 2017
jyknight added a comment.
Haven't looked in great detail, but overall looks sane to me.
It'll be great to also eliminate ADDC/ADDE/SUBC/SUBE, instead of adding an alternative method. Oh...and, SETCCE. Will probably need a new variant of that as well?
The FIXME for x86 seems pretty distasteful...
Possibly could handle things by having ADDCARRY A, B, CARRY -> RES, OUTCARRY expand into something along the lines of:
1. Create FLAGS value per CARRY input. (what's best way to spell that? New pseudo-op "setcarry" that expands into "ADD8RI CARRY, 255 -> unused, FLAGS", maybe?)
2. Do addition, using carry frmo flags register, input and output: x86isd::ADC A, B, FLAGS -> RES, OUTFLAGS
3. Grab carry bit from flags register: x86isd::setcc cond_b, OUTFLAGS -> OUTCARRY
Then, have a transform that converts "(setcarry (setcc cond_b FLAGS)) -> FLAGS" into just passing through FLAGS?
================
Comment at: include/llvm/CodeGen/ISDOpcodes.h:232
+ /// nodes take three operands: The first two are the normal lhs and rhs to
+ /// the add or sub, and the third is a boolean coming from uaddo/usubo or
+ /// another addcarry/subcarry operation. The use of this opcode is preferable
----------------
Value should be allowed to come from anywhere, not just uaddo/addcarry, although those would be most common.
https://reviews.llvm.org/D29872
More information about the llvm-commits
mailing list