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: Multi-use register clobbering.


Gyle Yearsley wrote:
Is there any way to tell gcc that a processor can operate in byte
mode on all four bytes of a 32 bit register? If any of the bytes are used
then gcc would have to realize that the rest of the register was clobbered.

It isn't clear what you are trying to describe here.


If you are talking about a multimedia type instruction, then you use the vector modes. V4QI is a 32-bit value composed of 4 1-byte elements.

If you are talking about bitfield insertion/extraction, then you can use zero_extract/sign_extract in the source/destination of a pattern to describe byte operations within a register.

There is also strict_lowpart, though this is really only used by some old ports like m68k, and this only works for the low byte.

There is also the possibility of using subregs, though this is probably best used only as a last resort.

I'm not sure what you mean when you say that the rest of the reg is clobbered when one byte is used. Does that mean that if you write to one byte, the other 3 bytes end up with unknown values? That seems like a poor hardware design. Why bother having 4 of them if you can only use 1 at a time? I suspect you meant something else.

The compiler is smart enough to know that it can't put two values in the same register if they overlap, so there is no need to worry about the register being used for a 1 byte value and a 4 byte value at the same time. That can't happen unless something is broken.
--
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]