2-3 General Purpose Registers and Data

This section describes general registers and memory data.

16 registers are available.
All general registers have same functions, and can be used for data operations and address pointer functions.

However there are index functions added to R0 and there are some operations that can be performed only by R0.

No general registers contain the stack pointer function. There are also no stack pointers in dedicated registers either.
There is no hardware stack pointer in the CPU of the SH-3.

The general registers operate with 32 bits.
When data that is not as long as 32 bits is read from memory, it is sign extended and saved in the general register as 32-bit data. Data that does not reach 32 bits is 1-byte or 2-byte word data.
In Renesas’ compiler the character type and short data types meet this condition, while the integer type and long data types are 32 bits so they are the same size as the general registers.

The data arrangement in memory can be set to either big-endian or little-endian with the mode pin.
It is necessary to restart from reset to make the change.

There are boundaries for word and long word data that are other than byte-size. Word data should be arranged from an address that is a multiple of 2 and long word data should be arranged from an address that is a multiple of 4, otherwise they cannot be handled as a single instruction.
There are boundaries also in little endian.

Therefore, when there is a global variable declaration the Renesas C compiler inserts unused area to handle it as a single instruction. The unused area can be eliminated by changing the variable declaration order this way.

When data is in packets like telecommunications data and its position cannot be changed, structure and specify it this way.

When data is transferred from memory to a general register it is sign extended.

When data is transferred from a general register to memory the high order bits are ignored.