rcr
Rotate right through carry flag
Rotates the destination right by the given count through CF; the low bit moves into CF each step.
8086 and later
CFPFAFZFSFDFOF ●–––––?
- ● set from the result
- ? undefined afterwards
- – not changed
- Reads CF
- OF Defined only for a count of 1.
- A count of 0 leaves every flag unchanged.
Forms
Operands
r/m- A general-purpose register or memory location matching the operation’s size, for example
raxorqword [rbp-8]. The byte registersah,bh,chanddhcannot be used with a REX prefix, including when the memory address usesr8–r15. imm8- An 8-bit immediate,
-128to255. Instructions that sign-extend it to a wider operand interpret the byte as-128to127; shift counts do not use this sign extension.
The rotation ring has 9, 17, 33 or 65 bits for an 8-, 16-, 32- or 64-bit operand. For example, rcl al, 1 moves the old high bit into CF and the old CF into bit 0. rcr rotates in the opposite direction. OF is defined only for a count of one.
The count comes from an immediate or cl. It is masked to six bits for a 64-bit operand, or five bits for smaller operands. For byte and word operands, the masked count is then reduced modulo 9 or 17. For 32- and 64-bit operands, the mask limits the count to 31 or 63; a written count of 32 or 64 respectively masks to zero.
global _start
section .text
_start:
mov rax, 12
mov rbx, 5
mov rcx, 3
mov rsi, 9
rcr rax, 1
mov rax, 60 ; syscall 60: exit
xor rdi, rdi
syscall