It takes two "llvm.uadd.with.overflow" instances to model the add-with-carry when there is a carry-in. Look at the IR generated by the example. I figured that the optimization of this would bedifficult (else it would have already been done :-)). And would this optimization have to be done for every architecture? On 02/15/2017 04:28 PM, Stephen Canon wrote:> > Why do you think this requires new intrinsics instead of teaching the optimizer what to do with the existing intrinsics? > > – Steve >
> On Feb 16, 2017, at 9:12 AM, Bagel <bagel99 at gmail.com> wrote: > > I figured that the optimization of this would bedifficult (else it would have already been done :-))Don’t make this assumption. There’s lots of opportunities for optimization scattered around. Some of them are left because they’re genuinely difficult, but most either simply haven’t been noticed by anyone, or are known but simply haven’t been done because no one has pushed for them (I’m fairly sure that this particular optimization falls into that category—folks have known the codegen wasn't great since these intrinsics were added, but no one has really complained about it, so people have worked on higher-impact stuff). – Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170216/c5ccd6fa/attachment.html>
On 02/16/2017 12:08 PM, Stephen Canon wrote:>> On Feb 16, 2017, at 9:12 AM, Bagel <bagel99 at gmail.com >> <mailto:bagel99 at gmail.com>> wrote: >> >> I figured that the optimization of this would bedifficult (else it would >> have already been done :-)) > > Don’t make this assumption. There’s lots of opportunities for optimization > scattered around. Some of them are left because they’re genuinely difficult, > but most either simply haven’t been noticed by anyone, or are known but simply > haven’t been done because no one has pushed for them (I’m fairly sure that this > particular optimization falls into that category—folks have known the codegen > wasn't great since these intrinsics were added, but no one has really > complained about it, so people have worked on higher-impact stuff).But I am still curious as to whether the optimization is architecture independent or must be done again for each backend? bagel