This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR middle-end/15239: Artificial limit in expand_mult



On Mon, 10 May 2004, Paolo Bonzini wrote:
> > -       mult_cost = MIN (12 * add_cost, mult_cost);
>
> Why not
>
>    if (optimize_size)
>      mult_cost = MIN (12 * add_cost, mult_cost);
>
> ?  This would make the code clearer.

Because when optimize_size is true, the backend's rtx_costs should
already return values based upon the size of instructions/instruction
sequences.

For example, on a pentium4, when not optimizing for size, the rtx_cost
of an addition is 1 and the rtx_cost of a multiplication is 15.  When
optimizing for size, the rtx_cost of an addition is 2 and that of a
multiplication is 3.  Hence on x86 with -Os, GCC will only replace a
multiplication with at most a single addition already.

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]