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

--- Comment #2 from Avinash Jayakar <avinashd at gcc dot gnu.org> ---
Currently this issue has been fixed for when the constant scenarios such as 
vector_a = vector_b * { c1, c2...}
where c1, c2 ... are perfect power of 2 and are positive.

For a more generic case, where adds or subs along with shifts are required, we
need to do a similar thing that is done in tree-vect-patterns.cc, where the
function vect_synth_mult_by_constant uses choose_mult_variant function to come
up with which variant of algorithm to use.

One main challenge of using that here is on how to determine the max cost of
MULT_EXPR. In patterns, MAX_INT is used because the benefit analyzer would
compare the scalar vs vector cost. In expmed.cc, set_src_cost is used. 
But such things are not possible in tree-vect-generic.cc, so 
Is it recommended to implement the cases where constants are not power of 2. If
so, what would be the max_cost parameter for the function choose_mult_variant?

Reply via email to