This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug regression/43892] PowerPC suboptimal "add with carry" optimization



------- Comment #7 from joakim dot tjernlund at transmode dot se  2010-05-20 12:13 -------
The below code doesn't generate any "add with carry" insn's for
either x86 nor powerpc:

u16
ipsum(u16 *buf, unsigned len, u16 sum)
{
  int rest, carry ;
  u32 acc_sum, *buf_u32, x;

  acc_sum = sum;
  len >>= 2;
  buf_u32 =  (u32 *) buf;
  carry = 0;
  for(buf_u32--; len; --len) {
          x = *++buf_u32;
          acc_sum += x;
          acc_sum += carry;
          carry = x > acc_sum ? 1 : 0;
  }
  acc_sum += carry;
  /* Add back carry outs from top 16 bits to low 16 bits.
   */
  acc_sum = (acc_sum >> 16) + (acc_sum & 0xffff);    /* add high-16 to low-16
*/
  acc_sum += (acc_sum >> 16); /* add carry */
  return acc_sum;
}


-- 

joakim dot tjernlund at transmode dot se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal
          Component|rtl-optimization            |regression


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]