[Bug target/83253] -ftree-slsr causes performance regression

mikulas at artax dot karlin.mff.cuni.cz gcc-bugzilla@gcc.gnu.org
Fri Dec 15 11:55:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83253

--- Comment #15 from mikulas at artax dot karlin.mff.cuni.cz ---
> Well, in theory multiplication by 3 isn't that expensive on i?86/x86_64,
> because lea can do that. But multiplication by 4 should be still cheaper or as
> cheap as, because if we do * 3 by lea, we can do * 4 by lea too

Multiplication by 4 can be combined for free with another addition (i.e. lea
eax, [ebx + ecx * 4] and multiplication by 3 can't. So, multilication by 4
should have lower cost than multiplication by 3, even if both result in just
one instruction.


More information about the Gcc-bugs mailing list