]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix costs of x86 move instructions at -Os
authorJan Hubicka <hubicka@ucw.cz>
Thu, 3 Apr 2025 11:06:07 +0000 (13:06 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Thu, 3 Apr 2025 11:09:22 +0000 (13:09 +0200)
commit564e4e0819022925dd160e455ee44baf0fda5805
treee15855bf736a0b67d082e5227dc247d323262930
parentb1b786580b9bddadcb179c84265655e2d2405b55
Fix costs of x86 move instructions at -Os

This patch fixes problem with size costs declaring all moves to have equal size
(which was caught by the sanity check I tried in prologue move cost hook).
Costs are relative to reg-reg move which is two. Coincidentally it is also size
of the encoding, so the costs should represent typical size of move
instruction.

The patch reduces cc1plus text size 26391115->26205707 (0.7%) and similar changes
also happens to other binaries build during bootstrap.

Bootsrapped/regtested x86_64-linux, plan to commit it tomorrow if there
are no complains

There are other targets that define some load/store costs to be 2 that probably
should be fixed too, but they are mostly very old ones and I don't have way of
benchmarking them.

* config/i386/x86-tune-costs.h (ix86_size_cost): Fix sizes of move
instructions
gcc/config/i386/x86-tune-costs.h