]> git.ipfire.org Git - thirdparty/gcc.git/commit
Consider frequency in cost estimation when converting scalar to vector.
authorliuhongt <hongtao.liu@intel.com>
Wed, 18 Dec 2024 06:32:31 +0000 (22:32 -0800)
committerliuhongt <hongtao.liu@intel.com>
Wed, 14 May 2025 12:46:52 +0000 (05:46 -0700)
commitf0d36c822c8b0918583c6bc3b1db01f2bb7f226b
tree91579c30803aa6887bb8e82412f3fc9b8cf0cf10
parent0e93f7cd4ed0cf6bcfda90ed4dcad51a1f65b4b6
Consider frequency in cost estimation when converting scalar to vector.

n some benchmark, I notice stv failed due to cost unprofitable, but the igain
is inside the loop, but sse<->integer conversion is outside the loop, current cost
model doesn't consider the frequency of those gain/cost.
The patch weights those cost with frequency.

gcc/ChangeLog:

PR target/120215
* config/i386/i386-features.cc
(scalar_chain::mark_dual_mode_def): Weight
cost of integer<->sse move with bb frequency when it's
optimized_for_speed_p.
(general_scalar_chain::compute_convert_gain): Ditto, and
adjust function prototype to return true/false when cost model
is profitable or not.
(timode_scalar_chain::compute_convert_gain): Ditto.
(convert_scalars_to_vector): Adjust after the upper two
function prototype are changed.
* config/i386/i386-features.h (class scalar_chain): Change
n_integer_to_sse/n_sse_to_integer to cost_sse_integer, and add
weighted_cost_sse_integer.
(class general_scalar_chain): Adjust prototype to return bool
intead of int.
(class timode_scalar_chain): Ditto.
gcc/config/i386/i386-features.cc
gcc/config/i386/i386-features.h