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] Reorganize rs6000_rtx_costs


>>>>> 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


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