On Wed, 10 Jul 2002, Bill Stoddard wrote: > > It's definitely a valid optimization. I just checked gcc on > > Sparc and it generates a shift rather than a division. But > > I've not looked at the generated code, but profiling indicates that an > additional division is happening, adding an extra 231 instructions. > (xlc_r -O2)
Note that even gcc will only do this optimization if -fstrength-reduce is specified (granted, for gcc that optimization is turned on automatically with -O2 and -O3). --Cliff