This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fixes to estimate_num_insns from pretty-ipa branch
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 09 Apr 2009 16:34:15 +0200
- Subject: Re: Fixes to estimate_num_insns from pretty-ipa branch
- References: <20090409141822.GB23648@kam.mff.cuni.cz>
> 3) When making original cost model I simply listed expensive nodes including DIV_EXPR.
> This is very unrealistic for expressions like a/8, a/12 that are common in my dumps.
> Now I basically just mark division by variable expensive. Divisions by constant are cheap.
> (this is not quite true for particularly ugly constants, but they are rare and we don't
> have very easy way to ask div expansion).
Yeah, a div is basically as expensive as a multiply.
You can get better estimates for mod by constant, if you make it cost 3
(one multiply for the division, one real multiply, and a subtraction).
GCC will rarely generate a div instruction for a mod by constant, so it
works well for all three weight vectors.
Paolo