Description of problem:
gcc does not combine several shift instructions into one rotate when
this is appropriate. This represent a regression against previous gcc
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. compile the attached test case with gcc -O3 -S test.c
2. examine output test.s
There are two shifts and one or instruction
There should be one rotate instruction
If you change the type of variable to unsigned int and shift counter
from 7 to 31 then it will work as expected, i.e. optimization is not
broken for integers.
Created attachment 105715 [details]
I certainly don't get rolb with GCC 3.2.3, 3.3.4 nor 3.4.2
(but get one with 2.96-RH and current CVS HEAD).
Given that it is not a recent regression, works with HEAD GCC,
all I'm going to do is:
FWIW, I get rolb with gcc4-4.0.0-0.8. This isn't surprising because it
works on HEAD, of course, but I'm mentioning this because it means the
reporter of this bug can try running "gcc4" instead of "gcc".
Sure, gcc4 can do it, but it isn't as solid as mainline gcc,
especially with regard to optimization. In particular it is known to
generate broken code with some projects out there.