This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Need advice and example with a port to big endian machine that puts characters in the MOST significant byte of registers
- From: "Mike Laman" <mlaman at cox dot net>
- To: "GCC" <gcc at gcc dot gnu dot org>
- Date: Sat, 26 Oct 2002 18:22:06 -0700
- Subject: Need advice and example with a port to big endian machine that puts characters in the MOST significant byte of registers
Hi,
I'm working on a port to a big endian machine that performs character
operations in
the most(!) significant byte of the register instead of the least
significant byte.
Byte operations from memory are just fine, though not as fast as register
operations
(as you'd expect).
It is expensive and inefficient to have to perform byte swapping in the
register
so the register (when the instruction is completed) has the byte in the
least
significant byte, as I believe GCC would assume/require the value to be.
Does GCC assume that after a movqi, with a destination register, the byte is
in the
least significant byte so the register can be referenced as an int (HI or
SI)?
Hmmmm. Maybe I'm making too much of this. Maybe it is ok to use the
machine's
natural byte(!) move, compare, add, subtract and ior operations in the most
significant byte
in the register?
Am I going to get burned, or is this the better approach (compared to
register byte swapping
for each byte access) where I have to plug all the holes in the "md" file?
What about register moves from a HI to a QI in a register? All sorts of
holes to plug I guess?
I'm thinking that this issue has been addressed before.
If there are some "md" files and architectures, please point them out, but
also PLEASE add a few sentences of
insight into GCC's abilities, restrictions and assumptions related to this
issue, so I understand
why a certain approach is better/right.
Thanks again for your time and help,
Mike