[Bug c/57157] Poor optimization of portable rotate idiom
noloader at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Aug 11 21:39:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57157
Jeffrey Walton <noloader at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |noloader at gmail dot com
--- Comment #6 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Jakub Jelinek from comment #4)
> Created attachment 30075 [details]
> /tmp/gcc49-pr57157.patch
>
> Untested tiny i386 improvement, instead of roll $31, %eax we can emit
> rorl %eax which is shorter.
Forgive my ignorance...
Why not put the shift amount in %ecx, %cx or %cl? The x86 processor will only
use the low-order 5-bits (low order 6-bits for x86_64). That means you get the
mask for free.
With a free mask, you don't even have to worry about the ranges in C/C++ or the
assembler's "I" or "J" constraints.
More information about the Gcc-bugs
mailing list