http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45216
--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> 2012-12-01 08:51:12
UTC ---
(In reply to comment #7)
> unsigned long rotate_left(unsigned long a, unsigned int shift)
> {
> return a << shift | a >> (sizeof(a) * 8 - shift);
> }
We have a regression in C++ in 4.8 there. Comparing -O3 -fdump-tree-optimized
in gcc-4.7, g++-4.7 and gcc-4.8:
D.1708_3 = a_1(D) r<< shift_2(D);
and in g++-4.8:
shift.0_2 = (int) shift_1(D);
_4 = a_3(D) << shift.0_2;
_5 = 64 - shift_1(D);
_6 = (int) _5;
_7 = a_3(D) >> _6;
_8 = _7 | _4;