This is the mail archive of the gcc@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: Constant folding and Constant propagation


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.

Ian


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