http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50031

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-10 
09:13:03 UTC ---
I think for more elaborate costs we should allow the backend to track costs
per loop by something like

  void *state = targetm.start_vect_loop_cost ();

pass that state pointer to each cost hook we call (making sure to avoid
"duplicate" calls)

and then finish off with

  final_cost = targetm.end_vect_loop_cost (state);

so the target could have for example a way to estimate resource allocation
(like in this case, 1000s permutes but only 10 real insns) and raise
costs accordingly.

A default implementation would simply have a unsigned int where it accumulates
costs (and we would maybe stop doing that in the vectorizer itself).  Thus,
really defer costs to the target (maybe even let it compute the cost for
the scalar variants by means of passing in the scalar gimple stmt).

Reply via email to