http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54674
--- Comment #10 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-24 21:26:16 UTC --- (In reply to comment #9) > To be clear, SLSR doesn't rely on mult costs being greater than int costs -- > it > simply trusts that the given costs are accurate and makes decisions based upon > them. > > Don't worry about the power-of-two shift cases. The logic in expmed.c that > SLSR, IVOPTS, and other passes rely on figures out whether a > multiply-by-coefficient can be replaced by a combination of > shifts/adds/subtracts based on the costs of those items versus the cost of a > multiply. It's just that, as things stand, it will never believe those > replacements are better since a general multiply appears to be so cheap (even > a > single shift/add will only be equal to a general multiply). > > Probably you will get some overall code gen improvement by just raising the > cost of the general multiply to reflect the average cycles for a multiply of > unknown values. Yeah, good point. I'll try it out and see what happens.