Instructions
Every instruction here takes one register, Rn, in bits 11 to 8. A shift by a larger fixed amount has its own instruction because
the one-bit shifts are the only ones that set T.
| Instruction | Encoding | Chip | What it does |
|---|---|---|---|
shll Rn | 0100 nnnn 0000 0000 | SH-1 | Shift left 1 bit; T = the bit shifted out of bit 31. |
shlr Rn | 0100 nnnn 0000 0001 | SH-1 | Shift right 1 bit, logical; T = the bit shifted out of bit 0. |
shal Rn | 0100 nnnn 0010 0000 | SH-1 | Shift left 1 bit, arithmetic: the same result as shll. |
shar Rn | 0100 nnnn 0010 0001 | SH-1 | Shift right 1 bit, arithmetic: bit 31 stays; T = the bit shifted out. |
shll2 Rn | 0100 nnnn 0000 1000 | SH-1 | Shift left 2 bits (T is not changed). |
shlr2 Rn | 0100 nnnn 0000 1001 | SH-1 | Shift right 2 bits, logical. |
shll8 Rn | 0100 nnnn 0001 1000 | SH-1 | Shift left 8 bits. |
shlr8 Rn | 0100 nnnn 0001 1001 | SH-1 | Shift right 8 bits, logical. |
shll16 Rn | 0100 nnnn 0010 1000 | SH-1 | Shift left 16 bits. |
shlr16 Rn | 0100 nnnn 0010 1001 | SH-1 | Shift right 16 bits, logical. |
rotl Rn | 0100 nnnn 0000 0100 | SH-1 | Rotate left 1 bit; T = the bit that wrapped round. |
rotr Rn | 0100 nnnn 0000 0101 | SH-1 | Rotate right 1 bit; T = the bit that wrapped round. |
rotcl Rn | 0100 nnnn 0010 0100 | SH-1 | Rotate left through T: T goes into bit 0 and bit 31 into T. Used in multiword shifts and with div1. |
rotcr Rn | 0100 nnnn 0010 0101 | SH-1 | Rotate right through T. |
shad Rm,Rn | 0100 nnnn mmmm 1100 | SH-3 | Dynamic arithmetic shift: when Rm is positive Rn is shifted left by the low 5 bits of Rm; when Rm is negative Rn is shifted right (arithmetic) by 32 minus those bits (an amount of 1 to 32). |
shld Rm,Rn | 0100 nnnn mmmm 1101 | SH-3 | The same, logical. |
Not described
Known, not yet covered
- Reference and viewer: the DSP shift instructions (
psha,pshl) and the SH-2A bit instructions.
Unknown
- Reference: none known.