The SH-4 features instruction set that is upward-compatible with the SH-1, SH-2, and SH-3 families. It uses 16-bit fixed length instructions in order to reduce the program code size. Except for BF and BT, all branch instructions and the RTE (return from exception instruction) implement so-called delayed branches, where the instruction following the branch is executed before the branch destination instruction.
All instructions are split into the following categories (with some examples):
- Fixed-point transfer instructions:
- MOV: Move data (or particular data types specified)
- SWAP: Swap register halves
- Arithmetic operation instructions:
- SUB: Subtract binary numbers
- CMP/EQ: Compare conditionally (in this case on equal to)
- Logic operation instructions:
- AND: AND logical
- XOR: Exclusive OR logical
- Shift instructions:
- ROTL: Rotate left
- SHLL: Shift logical left
- Branch instructions:
- BF: Branch if false
- JMP: Jump (unconditional branch)
- System control instructions...