This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Constant folding and Constant propagation
Ian Lance Taylor wrote:
> Jean Christophe Beyler <jean.christophe.beyler@gmail.com> writes:
>
>> All of these have an outer code of SET. Therefore, I'm not quite
>> positive of how I'm supposed to implement my rtx_cost function. Since
>> I don't seem to get a choice between a set 0xcb03 and a (plus 0xcafe
>> 5), how can I tell the compiler the different costs?
>
> Make the CONST_INT more expensive than the PLUS.
>
> But I don't know that gcc will implement the particular optimization
> that you are looking for. I'm not aware of any other processor which is
> able to load a large constant in a single instruction, but for which an
> add instruction is cheaper if there is a similar constant already
> available. You may need to implement this as a peephole or as a machine
> specific pass.
Take a look at reload_cse_move2add.
Bernd
--
This footer brought to you by insane German lawmakers.
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif