]> gcc.gnu.org Git - gcc.git/commit
rtlanal: optimize costly division in rtx_cost
authorAlexander Monakov <amonakov@ispras.ru>
Fri, 14 Feb 2020 17:14:36 +0000 (20:14 +0300)
committerAlexander Monakov <amonakov@ispras.ru>
Fri, 14 Feb 2020 17:22:36 +0000 (20:22 +0300)
commitd8305a03b4f0bb081dd9c88917cc8c48def22a80
treecb1eb11e78e31963e2d7e79195a9170a281aa2aa
parent519a33f954fd71cb8b74053e168e23a1cb00d30b
rtlanal: optimize costly division in rtx_cost

There's a costly signed 64-bit division in rtx_cost on x86 as well as
any other target where UNITS_PER_WORD expands to TARGET_64BIT ?  8 : 4.
It's also evident that rtx_cost does redundant work for a SET.

Obviously the variable named 'factor' rarely exceeds 1, so in the
majority of cases it can be computed with a well-predictable branch
rather than a division.

This patch makes rtx_cost do the division only in case mode is wider
than UNITS_PER_WORD, and also moves a test for a SET up front to avoid
redundancy.
No functional change.

* rtlanal.c (rtx_cost): Handle a SET up front. Avoid division if
the mode is not wider than UNITS_PER_WORD.
gcc/ChangeLog
gcc/rtlanal.c
This page took 0.057439 seconds and 5 git commands to generate.