Disabling unroll-and-jam for unsigned loop is unnecessary. Maybe we can set loop breaking condition to "i < (n >= u) n - u : 0", which incur only a little cost computing the upper bound before the loop is entered.
On my Linux/x8664 box, this loop nest is unroll-and-jammed by factor 5. With -m32 flag, I got correct code other than the infinite upper bound. With -m64, the sign of <n> , <j> and the comparison are completely wrong, see bellow: opencc ...-PHASE:clist=on l.c -LNO:simd=0 -LNO:pref=off ... cat a.w2c.c: ... for(i = 0U; (_INT32)(i) <= ((_INT32)(n) + -5); i = i + 5U) .... Shuxin On Tue, Sep 21, 2010 at 1:57 PM, Dror Maydan <may...@tensilica.com> wrote: > We ran into the following bug. > > int a[1024]; > void r(unsigned int n) > { > unsigned int i,j; > for (i=0; i<n; i++) { > for (j=0; j<n; j++) { > a[i]++; > } > } > } > > > At -O3, LNO outer unrolls the outer loop by setting the bound to > "i<n-u+1", creating an infinite loop whenever "n" is less than the > unroll factor. My memory is faded, but I thought it wasn't supposed to > do that for unsigned loops. From a quick scan of the code, I didn't > find anything that checks. Anyone have experience with this or a better > recollection than I do? > > Dror ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel