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: Efficient 64b operations


Jan Hoogerbrugge wrote:
This works fine except that it could be better in the case
a 32 bit value is added to a 64-bit value. Here is an example
where "1" is added to a long long.

RTL would be more useful as an example. The optimizer does not work on Trimedia instructions, it works on RTL, so it isn't obvious what is happening here.


We may also need info about your target port, patterns in the md file, macros in the .h file, etc.

Any idea whether peepholes for this would help?

I would think peepholes should be unnecessary for something as simple as this, but we don't have enough info.


Alternatively, I could test in the expansion whether I am adding
       - two 64b registers,
       - a 64b register and a 64b constant,
       - a 64b register and a 32b register,
       - or a 64b register and a 32b constant.
Any idea on how to do this? The which_alternative variable does not
seem to work.

You can use register_operand to check for registers, GET_CODE (x) == CONST_INT to check for constants, etc. However, this doesn't help if a constant is put into a register before the adddi3 pattern is called, so this won't completely solve your problem.


which_alternative only works after reload, and only if you have multiple constraints alternatives. It is mainly useful for emitting assembly language after optimization.

Are there architectures where I could learn from?

Probably, try looking at some of them. -- Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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