x86 Assembly Language Reference Manual

Rotate Left (rol)

rol{bwl}		imm8, r/m[8|16|32]
rol{bwl}		%cl, r/m[8|16|32]

r/m high-order bit -> CF

CF -> r/m low-order bit

r/m -> ShiftLeft


The left rotate instruction shifts all bits in the register or memory operand specified. The most significant bit is rotated to the carry flag, the carry flag is rotated to the least significant bit position, all other bits are shifted to the left. The result does not include the original value of the carry flag.

The first operand value indicates how many times the rotate takes place. The value is either the contents of the CL register or an immediate number. For a single rotate, where the first operand is one, the overflow flag (OF) is defined. For all other cases, OF is undefined. After the shift, the carry flag bit is XORed with the most significant result bit.

rclb $1, 1(%esi)
 rclb $253, 1(%esi)
 rclb %cl, 1(%esi)
 rcll $1, 4(%edi)
 rcll $253, 4(%edi)
 rcll %cl, 4(%edi)