Computer Instructions: Types of Operations
- Other Bit Manipulation Operations (involving bits):
- SHL: shift bits to the left. Example: SHL R1, 2 shifts R1 twice to the left ($00111000$ becomes $11100000$).
- SHR: shift bits to the right. Example: SHR R1, 3 shifts R1 $3$ times to the right ($00111000$ becomes $00000111$).
- SAL: ("shift arithmetic left") same as SHL.
- SAR: ("shift arithmetic right") similar to SHR, except that the sign bit remains the same. Example: with SHR R1, 3, $10111000$ becomes $10000111$ (the leftmost bit remains the same.)
- ROL: wraps/rotates around to the left. Example: with ROL R1, 2, $01011100$ becomes $01110001$.
- ROR: wraps/rotates around to the right. Example: with ROR R1, 3, $00111101$ becomes $10100111$.
- RCL: wraps/rotates around to the left through the carry bit. Example: with RCL R1, 2, $01011100$ w/ carry $1$ becomes $01110010$ carry $1$.
- RCR: wraps/rotates around to the right through the carry bit. Example: with RCR R1, 3, $00111101$ w/ carry $0$ becomes $01000111$ w/ carry $1$.