Jean Christophe Beyler <jean.christophe.bey...@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