The language I'm targeting doesn't have flags; I'd like to implement ADDE as a macro or psuedo-instruction that takes 3 parameters and returns 2. In my InstrInfo.td file, tablegen complains if I try to define multiple return values; adde is defined in TargetSelectionDAG.td to be a binary op that takes an extra flag in and sends an extra flag out. I tried to custom lower ADDE (by calling setOperationAction with ISD::ADDE) but it didn't seem to register and still bailed when trying to expand adde, instead of calling my LowerOperation. I could figure out how to create a fake flags registers, but I'd rather not have to. Any recommendations? Thanks, Dan
On Mon, Oct 27, 2008 at 10:11 AM, Daniel M Gessel <gessel at apple.com> wrote:> The language I'm targeting doesn't have flags; I'd like to implement > ADDE as a macro or psuedo-instruction that takes 3 parameters and > returns 2. > > In my InstrInfo.td file, tablegen complains if I try to define > multiple return values; adde is defined in TargetSelectionDAG.td to be > a binary op that takes an extra flag in and sends an extra flag out. > > I tried to custom lower ADDE (by calling setOperationAction with > ISD::ADDE) but it didn't seem to register and still bailed when trying > to expand adde, instead of calling my LowerOperation.ADDE should only be generated if you specify ADDC as legal. If ADDC is illegal, larger integer arith will be lowered to add and cmp sequences rather than addc adde sequences. Andrew
Thanks - that solves both problems. In the future, HW may have built in ADDE support, but will likely still not have flags - it'll just read 3 registers and write two. Any thoughts there? Thanks, Dan On Oct 27, 2008, at 12:07 PM, Andrew Lenharth wrote:> On Mon, Oct 27, 2008 at 10:11 AM, Daniel M Gessel <gessel at apple.com> > wrote: >> The language I'm targeting doesn't have flags; I'd like to implement >> ADDE as a macro or psuedo-instruction that takes 3 parameters and >> returns 2. >> >> In my InstrInfo.td file, tablegen complains if I try to define >> multiple return values; adde is defined in TargetSelectionDAG.td to >> be >> a binary op that takes an extra flag in and sends an extra flag out. >> >> I tried to custom lower ADDE (by calling setOperationAction with >> ISD::ADDE) but it didn't seem to register and still bailed when >> trying >> to expand adde, instead of calling my LowerOperation. > > ADDE should only be generated if you specify ADDC as legal. If ADDC > is illegal, larger integer arith will be lowered to add and cmp > sequences rather than addc adde sequences. > > Andrew > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> ADDE should only be generated if you specify ADDC as legal. If ADDC > is illegal, larger integer arith will be lowered to add and cmp > sequences rather than addc adde sequences.That said, it would be nice if ADDE/ADDC could be expanded into code sequences. The main problem is that there seems to be no way to generate results of type MVT::Flag (ADDC is supposed to produce one, and ADDE consume one). Ciao, Duncan.