Instruction
RCR
Rotates an operand right through the carry flag; APX adds a three-operand form.
- Extensions
- Forms
- 36 (12 Legacy, 24 EVEX)
- Data
- Intel XED v2026.08.23
RCR rotates its operand right through the carry flag: CF and the operand form one ring of 9, 17, 33 or 65 bits, so the bit leaving bit 0 goes into CF and the old CF comes in at the top. By one bit, it is a right shift that brings CF in at the top, which is how assembly shifts a number wider than a register right: SHR, or SAR for a signed number, on the highest word, then RCR by 1 on each word below. The same step halves a sum that overflowed: after an ADD that set CF, RCR by 1 gives the true average. RCL is the mirror image, and its page gives the rules for the count, which RCR shares.
OF, and the counts that do nothing
Both manuals define OF for a count of 1 alone, as the exclusive or of the result’s two top bits, that is, the old top bit XOR the old CF. In the 97 recorded cases with a larger masked count, Zen 5 set OF by the same rule. Eight were whole turns, a byte by 9, 18 or 27 or a word by 17, which left the value and CF as they were but changed OF in five; code should not rely on it.
A masked count of 0 changes no flag, and in its 37 such cases Zen 5 changed none. It still wrote a 32-bit register: by 0, 32 or 64, RCR cleared bits 63:32, as any write of a 32-bit register does.
In compiled code
Neither GCC 14 nor Clang 23 used RCR at -O2 in our builds. A 128-bit
x >> 1 became SHRD and SHR (SAR when signed). The average of two
64-bit numbers through a 128-bit sum became ADD, ADC and SHRD in GCC,
while Clang computed (a & b) + ((a ^ b) >> 1), which needs no carry.
Cost and other forms
AMD’s Zen 5 guide lists RCR with an immediate count as one macro-op with a latency of one cycle, and as microcoded with the count in CL. APX adds forms with a new destination register, but none that leaves the flags alone.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
RCR m8, imm8
RCR_MEMb_IMMb | C0 /3 ib | Base instruction set |
RCR r8, imm8
RCR_GPR8_IMMb | C0 /3 ib | Base instruction set |
RCR m16/32/64, imm8
RCR_MEMv_IMMb | C1 /3 ib | Base instruction set |
RCR r16/32/64, imm8
RCR_GPRv_IMMb | C1 /3 ib | Base instruction set |
RCR m8, 1
RCR_MEMb_ONE | D0 /3 | Base instruction set |
RCR r8, 1
RCR_GPR8_ONE | D0 /3 | Base instruction set |
RCR m16/32/64, 1
RCR_MEMv_ONE | D1 /3 | Base instruction set |
RCR r16/32/64, 1
RCR_GPRv_ONE | D1 /3 | Base instruction set |
RCR m8, CL
RCR_MEMb_CL | D2 /3 | Base instruction set |
RCR r8, CL
RCR_GPR8_CL | D2 /3 | Base instruction set |
RCR m16/32/64, CL
RCR_MEMv_CL | D3 /3 | Base instruction set |
RCR r16/32/64, CL
RCR_GPRv_CL | D3 /3 | Base instruction set |
RCR r8, imm8
RCR_GPR8i8_IMM8_APX | EVEX.LLZ.NP.MAP4.WIG C0 /3 ib | APX_F |
RCR m8, imm8
RCR_MEMi8_IMM8_APX | EVEX.LLZ.NP.MAP4.WIG C0 /3 ib | APX_F |
RCR r16/32/64, r16/32/64, imm8 NDD
RCR_GPRv_GPRv_IMM8_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE C1 /3 ib ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r16/32/64, m16/32/64, imm8 NDD
RCR_GPRv_MEMv_IMM8_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE C1 /3 ib ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r8, 1
RCR_GPR8i8_ONE_APX | EVEX.LLZ.NP.MAP4.WIG D0 /3 | APX_F |
RCR m8, 1
RCR_MEMi8_ONE_APX | EVEX.LLZ.NP.MAP4.WIG D0 /3 | APX_F |
RCR r8, r8, 1 NDD
RCR_GPR8i8_GPR8i8_ONE_APX_N3 | EVEX.LLZ.NP.MAP4.WIG D0 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r8, m8, 1 NDD
RCR_GPR8i8_MEMi8_ONE_APX_N3 | EVEX.LLZ.NP.MAP4.WIG D0 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r16/32/64, 1
RCR_GPRv_ONE_APX | EVEX.LLZ.NP.MAP4.SCALABLE D1 /3 | APX_F |
RCR m16/32/64, 1
RCR_MEMv_ONE_APX | EVEX.LLZ.NP.MAP4.SCALABLE D1 /3 | APX_F |
RCR r16/32/64, r16/32/64, 1 NDD
RCR_GPRv_GPRv_ONE_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE D1 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r16/32/64, m16/32/64, 1 NDD
RCR_GPRv_MEMv_ONE_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE D1 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r8, CL
RCR_GPR8i8_CL_APX | EVEX.LLZ.NP.MAP4.WIG D2 /3 | APX_F |
RCR m8, CL
RCR_MEMi8_CL_APX | EVEX.LLZ.NP.MAP4.WIG D2 /3 | APX_F |
RCR r8, r8, CL NDD
RCR_GPR8i8_GPR8i8_CL_APX_N3 | EVEX.LLZ.NP.MAP4.WIG D2 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r8, m8, CL NDD
RCR_GPR8i8_MEMi8_CL_APX_N3 | EVEX.LLZ.NP.MAP4.WIG D2 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r16/32/64, CL
RCR_GPRv_CL_APX | EVEX.LLZ.NP.MAP4.SCALABLE D3 /3 | APX_F |
RCR m16/32/64, CL
RCR_MEMv_CL_APX | EVEX.LLZ.NP.MAP4.SCALABLE D3 /3 | APX_F |
RCR r16/32/64, r16/32/64, CL NDD
RCR_GPRv_GPRv_CL_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE D3 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r16/32/64, m16/32/64, CL NDD
RCR_GPRv_MEMv_CL_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE D3 /3 ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r8, r8, imm8 NDD
RCR_GPR8i8_GPR8i8_IMM8_APX_N3 | EVEX.LLZ.NP.MAP4.WIG C0 /3 ib ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r8, m8, imm8 NDD
RCR_GPR8i8_MEMi8_IMM8_APX_N3 | EVEX.LLZ.NP.MAP4.WIG C0 /3 ib ND=1 | APX_F + APX_NCI_NDD_NF |
RCR r16/32/64, imm8
RCR_GPRv_IMM8_APX | EVEX.LLZ.NP.MAP4.SCALABLE C1 /3 ib | APX_F |
RCR m16/32/64, imm8
RCR_MEMv_IMM8_APX | EVEX.LLZ.NP.MAP4.SCALABLE C1 /3 ib | APX_F |
Latency and throughput
| Model | m8, imm8 | r8, imm8 | m16, imm8m32, imm8m64, imm8 | r16, imm8 | r32, imm8r64, imm8 | m8, 1 | r8, 1r16, 1r32, 1r64, 1 | m16, 1m32, 1m64, 1 | m8, CL | r8, CL | m16, CLm32, CLm64, CL | r16, CL | r32, CLr64, CL |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sandy Bridge | 11 / 3.5p05 | 3 / 2.67p015 | 11 / 3.5p05 | 3 / 2.67p015 | 3 / 2.67p015 | 11 / 3.5p05 | 2 / 1p015 | 11 / 3.5p05 | 11 / 3.5p05 | 5 / 4p05 | 11 / 3.5p05 | 5 / 4p05 | 5 / 4p05 |
| Haswell | 9 / 0.75p0156 | 5 / 2p0156 | 9 / 0.75p0156 | 5 / 2p0156 | 5 / 2p0156 | 9 / 0.75p0156 | 2 / 0.75p0156 | 9 / 0.75p0156 | 19 / 2.25p0156 | 14 / 2.5p0156 | 19 / 2.25p0156 | 11 / 2p0156 | 11 / 2p0156 |
| Broadwell, Skylake, Skylake-SP, Ice Lake | 8 / 0.75p0156 | 5 / 2p0156 | 8 / 0.75p0156 | 5 / 2p0156 | 5 / 2p0156 | 8 / 0.75p0156 | 2 / 0.75p0156 | 8 / 0.75p0156 | 18 / 2.25p0156 | 14 / 2.5p0156 | 18 / 2.25p0156 | 11 / 2p0156 | 11 / 2p0156 |
| Alder Lake, Sapphire Rapids | 13 / 1p0 p1 p5 p6 p11 | 2 / 1p0 p1 p5 p6 p11 | 12 / 1p0 p1 p5 p6 p11 | 2 / 1p0 p1 p5 p6 p11 | 2 / 1p0 p1 p5 p6 p11 | 13 / 1p0 p1 p5 p6 p11 | 2 / 1p0 p1 p5 p6 p11 | 12 / 1p0 p1 p5 p6 p11 | 20 / 3p0 p1 p5 p6 p11 | 9 / 3p0 p1 p5 p6 p11 | 19 / 2p0 p1 p5 p6 p11 | 8 / 2p0 p1 p5 p6 p11 | 8 / 2p0 p1 p5 p6 p11 |
| Lunar Lake | 13 / 0.67p012345 | 2 / 0.67p012345 | 12 / 0.67p012345 | 2 / 0.67p012345 | 2 / 0.67p012345 | 13 / 0.67p012345 | 2 / 0.67p012345 | 12 / 0.67p012345 | 20 / 1.5p012345 | 9 / 1.67p012345 | 19 / 1.67p012345 | 8 / 1.17p012345 | 8 / 1.17p012345 |
| Bonnell | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 | 1 / 1p0 |
| Silvermont | 4 / 2IEC0 MEC | 1 / 1IEC0 | 4 / 2IEC0 MEC | 1 / 1IEC0 | 1 / 1IEC0 | 4 / 2IEC0 MEC | 1 / 1IEC0 | 4 / 2IEC0 MEC | 4 / 2IEC0 MEC | 1 / 1IEC0 | 4 / 2IEC0 MEC | 1 / 1IEC0 | 1 / 1IEC0 |
| Piledriver | 5 / 2EX0 EX1 | 12 / 11.5EX0 EX1 | 5 / 2EX0 EX1 | 10 / 9.5EX0 EX1 | 7 / 7EX0 EX1 | 5 / 2EX0 EX1 | 1 / 1EX0 EX1 | 5 / 2EX0 EX1 | 5 / 2EX0 EX1 | 11 / 11EX0 EX1 | 5 / 2EX0 EX1 | 9 / 9EX0 EX1 | 7 / 6.5EX0 EX1 |
| Zen, Zen 2 | 100 / 0.25 | 1 / 0.25ALU0 ALU1 ALU2 ALU3 | 100 / 0.25 | 1 / 0.25ALU0 ALU1 ALU2 ALU3 | 1 / 0.25ALU0 ALU1 ALU2 ALU3 | 100 / 0.25 | 1 / 0.25ALU0 ALU1 ALU2 ALU3 | 100 / 0.25 | 100 / 0.25 | 1 / 0.25ALU0 ALU1 ALU2 ALU3 | 100 / 0.25 | 1 / 0.25ALU0 ALU1 ALU2 ALU3 | 1 / 0.25ALU0 ALU1 ALU2 ALU3 |
| Zen 3, Zen 4 | 7 / 4ALU1 ALU2 | 3 / 3ALU1 ALU2 | 7 / 4ALU1 ALU2 | 3 / 3ALU1 ALU2 | 3 / 3ALU1 ALU2 | 5 / 1ALU1 ALU2 | 1 / 1ALU1 ALU2 | 5 / 1ALU1 ALU2 | 7 / 4ALU1 ALU2 | 3 / 3ALU1 ALU2 | 7 / 4ALU1 ALU2 | 3 / 3ALU1 ALU2 | 3 / 3ALU1 ALU2 |
| Jaguar | 4 / 1ALU0 ALU1 | 1 / 0.5ALU0 ALU1 | 4 / 1ALU0 ALU1 | 1 / 0.5ALU0 ALU1 | 1 / 0.5ALU0 ALU1 | 4 / 1ALU0 ALU1 | 1 / 0.5ALU0 ALU1 | 4 / 1ALU0 ALU1 | 4 / 1ALU0 ALU1 | 1 / 0.5ALU0 ALU1 | 4 / 1ALU0 ALU1 | 1 / 0.5ALU0 ALU1 | 1 / 0.5ALU0 ALU1 |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
a = dest.read()
n = count & (0x3F if OSIZE == 64 else 0x1F) # the count is masked,
k = n % (OSIZE + 1) # then taken modulo OSIZE + 1: CF is a
# bit of the rotation (9 for 8 bits)
x = cf << OSIZE | a # CF above the operand
y = x >> k | x << (OSIZE + 1 - k)
r = low(y)
if n != 0: # a count of 0 changes no flag
cf = y >> OSIZE & 1 # the bit rotated out of bit 0; CF as
# it was when k is 0
flip = msb(r) ^ (r >> (OSIZE - 2) & 1)
of = flip if n == 1 else UNDEFINED # the top two bits differ
dest.write(r) # even for a count of 0, a 32-bit register
# gets bits 63:32 cleared
Run on AMD Zen 5 (EPYC 9645): 227 cases. The APX forms were not run: none of these processors has APX.
a = src.read()
n = count & (0x3F if OSIZE == 64 else 0x1F) # the count is masked,
k = n % (OSIZE + 1) # then taken modulo OSIZE + 1: CF is a
# bit of the rotation (9 for 8 bits)
x = cf << OSIZE | a # CF above the operand
y = x >> k | x << (OSIZE + 1 - k)
r = low(y)
if n != 0: # a count of 0 changes no flag
cf = y >> OSIZE & 1 # the bit rotated out of bit 0; CF as
# it was when k is 0
flip = msb(r) ^ (r >> (OSIZE - 2) & 1)
of = flip if n == 1 else UNDEFINED # the top two bits differ
dest.write(r) # the new destination: bits 63:OSIZE
# cleared, even for 8 and 16 bits
Not run on a processor: none of these processors has APX.
Operands
| Operand | Kind | Action |
|---|---|---|
RCR r/m8, imm8 RCR r/m16/32/64, imm8 | ||
r/m8/16/32/64 | explicit | read, write |
imm8 | explicit | read |
RFLAGS | implicit | read, write |
RCR r/m8, 1 RCR r/m16/32/64, 1 | ||
r/m8/16/32/64 | explicit | read, write |
1 | explicit | read |
RFLAGS | implicit | read, write |
RCR r/m8, CL RCR r/m16/32/64, CL | ||
r/m8/16/32/64 | explicit | read, write |
CL | explicit | read |
RFLAGS | implicit | read, conditional write |
RCR r8, r/m8, imm8 NDD RCR r16/32/64, r/m16/32/64, imm8 NDD | ||
r8/16/32/64 | explicit | write |
r/m8/16/32/64 | explicit | read |
imm8 | explicit | read |
RFLAGS | implicit | read, write |
RCR r8, r/m8, 1 NDD RCR r16/32/64, r/m16/32/64, 1 NDD | ||
r8/16/32/64 | explicit | write |
r/m8/16/32/64 | explicit | read |
1 | explicit | read |
RFLAGS | implicit | read, write |
RCR r8, r/m8, CL NDD RCR r16/32/64, r/m16/32/64, CL NDD | ||
r8/16/32/64 | explicit | write |
r/m8/16/32/64 | explicit | read |
CL | explicit | read |
RFLAGS | implicit | read, conditional write |
Flags
| When | OF | CF |
|---|---|---|
RCR r/m8, imm8 RCR r/m16/32/64, imm8 RCR r8, r/m8, imm8 NDD RCR r16/32/64, r/m16/32/64, imm8 NDD | ||
| count 1 | M | TM |
| count 2 or more | U | TM |
RCR r/m8, 1 RCR r/m16/32/64, 1 RCR r8, r/m8, 1 NDD RCR r16/32/64, r/m16/32/64, 1 NDD | ||
| M | TM | |
RCR r/m8, CL RCR r/m16/32/64, CL RCR r8, r/m8, CL NDD RCR r16/32/64, r/m16/32/64, CL NDD | ||
| in some cases | U | TM |
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- Legacy forms
- none in XED
- EVEX forms
APX-EVEX-INT
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
I186 | No CPUID bit: part of the base instruction set. | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
I86 | No CPUID bit: part of the base instruction set. | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
APX_F | APX_F | Nova Lake, Diamond Rapids |
APX_F_N3 | APX_F + APX_NCI_NDD_NF | Same as APX_F |
More General-purpose instructions
- MOV
- MOVS
- MOVSX
- MOVSXD
- MOVZX
- MUL
- NEG
- NOP
- NOT
- OR
- OUT
- OUTS
- PAUSE
- POP
- POPA
- POPF
- PUSH
- PUSHA
- PUSHF
- RCL
- RET
- ROL
- ROR
- SALC
- SAR
- SBB
- SCAS
- SETcc
- SHL
- SHLD
- SHR
- SHRD
- STC
- STD
- STI
- STOS
- SUB
- TEST
- UD0
- UD1
All 109 General-purpose instructions
More APX instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s
-marchfeature sets and AMD’s Processor Programming References, which the page of each processor cites. - LLVM 23.1.2's x86 scheduling models (commit
85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-533 (RCL/
RCR/ ROL/ ROR) - Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
- AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.39, October 2026)
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The timings come from LLVM's scheduling models, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.