> -----Original Message----- > From: Andreas Schwab [mailto:sch...@linux-m68k.org] > Sent: 30 January 2014 14:29 > To: Paulo Matos > Cc: gcc@gcc.gnu.org > Subject: Re: Regression [v850,mep...]: sign_extend in loop breaks > zero-overhead > loop generation > > Paulo Matos <pma...@broadcom.com> writes: > > > void > > foo (short blockSize) > > { > > short i; > > unsigned short loopCount; > > > > loopCount = (unsigned short) (blockSize + delayLength) % 8; > > for (i = 0; i < loopCount; i++) > > *temp_ptr++ = x ^ *temp_ptr++; > > } > > You know that this is undefined code? >
Correct, my apologies. I didn't notice the undefined behaviour that the reducer introduced in the original code. However, the issue persists. If instead I write: void foo (short blockSize) { short i; unsigned short loopCount; loopCount = (unsigned short) (blockSize + delayLength) % 8; for (i = 0; i < loopCount; i++) *temp_ptr++ = x ^ *temp_ptr; } the sign extend is still generated from the referenced commit and persists until trunk. This causes the zero overhead loop not to be generated. Thanks, Paulo Matos > Andreas. > > -- > Andreas Schwab, sch...@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different."