[patch] Fix PR target/62631

Eric Botcazou ebotcazou@adacore.com
Thu Feb 5 15:55:00 GMT 2015


Hi,

this is the failure of gcc.dg/tree-ssa/ivopts-lt-2.c on SPARC 64-bit, but I 
think that the problem is actually generic: get_shiftadd_cost only calls 
shiftadd_cost to get the cost of a "shift-add", which is actually a multiply 
by a power-of-2 operation.  Since SPARC doesn't have a lea-like instruction, 
shiftadd_cost returns a very high cost, about 3 times the cost of an add+shift 
sequence which is what the RTL expander will generate for this operation.

So I think that get_shiftadd_cost should mimic the algorithms in expmed.c and 
use the minimum of shiftadd_cost and (add_cost + shift_cost) for the cost of 
the shift-add operation.

Tested on x86-64, SPARC and SPARC64, OK for the mainline?


2015-02-05  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/62631
	* tree-ssa-loop-ivopts.c (get_shiftadd_cost): Use the mininum of costs
	of shift-add and (add + shift) operations.  Rename local variable.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr62631-2.diff
Type: text/x-patch
Size: 1273 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150205/788bed8f/attachment.bin>


More information about the Gcc-patches mailing list