http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51708
--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-30 23:11:09 UTC --- In order to 'force' the constant load to be CSE-ed the constant load and dynamic shift patterns have to be emitted in the respective expanders, so that the CSE pass can see the constant load. It would be even better to check whether the shift insn is in a loop when deciding whether to use a dynamic shift insn or not. It is better to convert all non 1/2/8/16 shifts that are buried inside loops to dynamic shifts. If there are enough registers available every shift would become a 1 insn operation.