This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Reorganize rs6000_rtx_costs
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 02 Jul 2004 10:55:03 -0400
- Subject: Re: [PATCH] Reorganize rs6000_rtx_costs
- References: <Pine.LNX.4.44.0407012055320.31623-100000@www.eyesopen.com>
>>>>> Roger Sayle writes:
>> Also, the original code returned COSTS_N_INSNS(2), not COSTS_N_INSNS(1),
>> for optimize_size. Any reason for the change?
Roger> This is intentional. The PowerPC's RISC architecture means that the
Roger> sizes of additions, multiplications and divisions are the same. There
Roger> seemed no point leaving this bug in the existing code, and although
Roger> unlikely, its possible that estimating a division as "cheaper" than
Roger> a multiplication might produce undesirable side-effects in the RTL
Roger> optimizers. For example, implementing a floating point multiplication
Roger> as a division by a reciprocal!
I'm not saying that division should be less expensive than
multiplication. I specifically set the cost of multiplication for
optimize_size to be greater than one in case another, single, cheaper
instruction could perform the multiply, e.g., shift. In other words, even
for optimize_size, the cost of the instructions is not uniform, multiply
just needs to be less than the other sequence. I think the cost of both
multiply and divide for optimize_size should be 2. What's the reason not
to make it 2?
Thanks, David