On Tue, Feb 26, 2008 at 12:12 PM, Revital1 Eres <[EMAIL PROTECTED]> wrote: > > Hello, > > I am running the attached testcase (inspired from vect/vect-reduc-3.c > testcase) with -O3 -fwrapv on powerpc64-linux with trunk 4.4. > > Here is a snippet from the testcase: > > ... > > unsigned short ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; > unsigned short uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; > unsigned short udiff; > > > udiff = 0; > for (i = 0; i < n; i++) {, > udiff += (ub[i] - uc[i]);, > } >
This is done by fold (see the .original dump), both operands decay to int according to C rules, so fold sees (unsigned short)((int)ub[i] - (int)uc[i] + (int)udiff) and thinks that (short unsigned int) ((short int) (ub[i] - uc[i]) + (short int) udiff) is a better way to compute it. Richard.