------- Comment #5 from rguenth at gcc dot gnu dot org  2010-04-26 14:43 -------
(In reply to comment #4)
> Subject: Re:  PowerPC suboptimal "add with carry" optimization
> 
> "dje at gcc dot gnu dot org" <gcc-bugzi...@gcc.gnu.org> wrote on 2010/04/26
> 15:53:01:
> >
> > ------- Comment #3 from dje at gcc dot gnu dot org  2010-04-26 13:52 -------
> > As Jakub mentioned, i386.md implements the addcc named pattern and rs6000.md
> > does not provide that named pattern yet.
> 
> Will that also address the loop optimization? I don't think so.

No.

Actually compilable testcase:

typedef unsigned int u32;

u32
add32carry(u32 sum, u32 x)
{
  u32 z = sum + x;
  if (sum + x < x)
    z++;
  return z;
}

u32
loop(u32 *buf, int len)
{
  u32 sum = 0;
  for(; len; --len)
    sum = add32carry(sum, *++buf);
  return sum;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43892

Reply via email to