Extensions
Mnemonics
MOVS, MOVSB, MOVSW, MOVSD, MOVSQ
Forms
8 (8 Legacy)
Data
Intel XED v2026.08.23

MOVS copies one element, a byte, word, doubleword or quadword, from [RSI] to [RDI] and moves both pointers to the next element: up while the direction flag is clear, down while it is set. A REP prefix repeats it RCX times, counting RCX down to 0, so rep movsb is a whole memcpy in two bytes, with RDI, RSI and RCX as its arguments. GCC 14 at -O2 copies a 512-byte struct with mov ecx, 64 and rep movsq, where Clang 23 calls memcpy.

The doubleword form shares its name with SSE2’s MOVSD, a move of one double; assemblers tell them apart by the operands.

Things to know

  • Direction. System V and Microsoft x64 require the direction flag clear at calls and returns (see the registers), so code can use MOVS without a CLD; code that sets the flag with STD must clear it again.
  • Overlap. The copy is defined element by element, so a destination one element above the source repeats the first element all along, as Zen 5 recorded. Copying such buffers downward, with DF set, works but is much slower on Intel’s processors, whose optimization manual suggests copying the overlapping tail first instead (Section 3.7.6.3).
  • Interruptions. A REP MOVS can stop between elements for an interrupt or a page fault, with RCX, RSI and RDI describing the work left and RIP still at the instruction, which then resumes.
  • Address size. With a 67 prefix it uses ESI, EDI and, under REP, ECX, and writes them as 32-bit registers, clearing their upper halves.
  • F2. Neither manual lists REPNE with MOVS, but XED decodes F2 A4 as REP MOVSB, and Zen 5 repeated it the same way.

Fast strings

Processors may run a REP MOVS in groups of several elements, which Intel calls fast-string operation. The stores of one instruction may then reach other processors out of order, or repeated (Intel’s Volume 3A, Section 11.2.4). On Zen 5 too they may arrive out of order, and copies at least the size of the L3 cache use streaming stores (AMD’s guide, Section 2.13.6). Both vendors keep the instruction’s stores after older stores and before younger ones, so a flag written after the copy still publishes it. Intel’s processors report enhanced REP MOVSB and STOSB in CPUID.(EAX=7,ECX=0):EBX[9], and faster copies of 1 to 128 bytes in EDX[4] (optimization manual, Section 3.7.6).

In the optimization guide

What the optimization guide says about MOVS, a line per claim. Each links to the claim in the guide, with its sources and where they differ.

Memory

  • REP MOVS and STOS: Intel’s cores made rep movsb and rep stosb fast from Ivy Bridge, and short strings fast from Ice Lake and Golden Cove, as CPUID reports.
  • REP MOVS and STOS: rep movs is not always the fastest copy: short or misaligned copies can be faster with vector registers.

Bulldozer to Excavator

  • Integer execution: rep movs and rep stos have a fast microcode path that moves 16 bytes at a time when the direction flag is clear, the blocks do not overlap and the addresses are aligned to the operand size.

Golden Cove and Raptor Cove

  • Loads, stores and caches: Short rep movsb, rep stosb, rep cmpsb and rep scasb are fast: with the data in the L1 cache, any length up to 128 bytes takes a flat 9, 12, 15 and 15 cycles, zero included except for the compares.

Haswell and Broadwell

  • Loads, stores and strings: rep movsb copies more than 20 bytes a cycle when the copy is long, using the 256-bit store path, but loses to SIMD code below a few hundred bytes; rep stosb fills up to 32 bytes a cycle when the count is large.

Ice Lake to Rocket Lake

  • Loads, stores and caches: rep movsb is fast for 1 to 128 bytes, reported by CPUID leaf 7, EDX bit 4, while rep stosb is unchanged. sources differ

Sandy Bridge and Ivy Bridge

  • What Ivy Bridge changed: Ivy Bridge is the first core with enhanced REP MOVSB and STOSB, flagged by CPUID leaf 7’s EBX bit 9, which make a byte-granularity REP string fast as well as flexible for memory copies and fills; on Ivy Bridge itself, though, Intel’s manual notes they may still not reach the throughput of a hand-written 128-bit or 256-bit AVX copy.

Silvermont to Goldmont Plus

  • Loads, stores and caches: rep movsb and rep stosb are enhanced from Silvermont on, but rep movs suffers from line splits.

Skylake to Cooper Lake

  • Loads, stores and caches: rep movs reaches full speed only with source and destination both aligned to 32 bytes; otherwise a copy with YMM or ZMM registers is faster.

Zen 5

  • Loads, stores and caches: rep movs and rep stos of at least the size of the L3 store with streaming stores that bypass the caches, and on some systems smaller ones skip reading the lines they overwrite whole.

Vulnerability mitigations

Mitigations of these processor vulnerabilities use MOVS:

Forms

Every encoding of MOVS that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
MOVSB MOVSBA4Base instruction set
MOVSW MOVSW66 A5Base instruction set
MOVSD MOVSDA5Base instruction set
MOVSQ 64-bit mode only MOVSQREX.W A5LM
REP MOVSB REP_MOVSBF3 A4
F2 A4
Base instruction set
REP MOVSW REP_MOVSW66 F3 A5
66 F2 A5
Base instruction set
REP MOVSD REP_MOVSDF3 A5
F2 A5
Base instruction set
REP MOVSQ 64-bit mode only REP_MOVSQF3 REX.W A5
F2 REX.W A5
LM

Latency and throughput

What the scheduling models of LLVM 23.1.2 give for each form, not measurements: latency / reciprocal throughput in cycles, the ports under them. A row is a model, or models that agree; a dash, a form that its processors lack. Memory forms: latency from the address, ports without the load and store units. Which processors each model covers.
ModelMOVSB
MOVSB
MOVSW
MOVSD
MOVSQ
MOVSW
MOVSD
MOVSQ
Sandy Bridge8 / 1p0 p1 p4 p5 p238 / 1p0 p1 p4 p5 p23
Haswell4 / 1p01234564 / 1p0123456
Broadwell, Skylake, Skylake-SP, Ice Lake100 / 0.25p0156100 / 0.25p0156
Alder Lake, Sapphire Rapids8 / 0.8p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p117 / 0.8p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11
Lunar Lake8 / 0.67p0 p1 p2 p3 p4 p5 p10 p11 p20 p21 p22 p25 p26 p277 / 0.67p0 p1 p2 p3 p4 p5 p10 p11 p20 p21 p22 p25 p26 p27
Bonnell3 / 1.5p013 / 1.5p01
Silvermont100 / 1FPC0100 / 1FPC0
Piledriver100 / 0.5EX0 EX1100 / 0.5EX0 EX1
Zen, Zen 2100 / 0.25100 / 0.25
Zen 3, Zen 4100 / 25ALU0 ALU1 ALU2 ALU3100 / 25ALU0 ALU1 ALU2 ALU3
Jaguar100 / 0.5ALU0 ALU1100 / 0.5ALU0 ALU1

Operation

What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.

All forms but the REP forms
n = OSIZE // 8
step = -n if df else n           # DF set: down
store(aDI, OSIZE, load(aSI, OSIZE))
aSI = low(aSI + step, ASIZE)
aDI = low(aDI + step, ASIZE)

Run on AMD Zen 5 (EPYC 9645): 16 cases.

REP forms
n = OSIZE // 8
step = -n if df else n
s = aSI
d = aDI
for i in range(aCX):             # nothing at all when aCX is 0
    # one element after the other: a destination one element
    # ahead of the source repeats the first element all along
    store(d, OSIZE, load(s, OSIZE))
    s = low(s + step, ASIZE)
    d = low(d + step, ASIZE)
aSI = s                          # 67 prefix: bits 63:32 cleared
aDI = d
aCX = 0

Run on AMD Zen 5 (EPYC 9645): 32 cases.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
MOVSB MOVSW MOVSD MOVSQ 64-bit mode only
m8/16/32/64 at ES:[rDI]implicitwrite
rDIimplicitread, write
m8/16/32/64 at [rSI]implicitread
rSIimplicitread, write
RFLAGSimplicitread
REP MOVSB REP MOVSW REP MOVSD REP MOVSQ 64-bit mode only
m8/16/32/64 at ES:[rDI]implicitconditional write
rDIimplicitread, conditional write
m8/16/32/64 at [rSI]implicitconditional read
rSIimplicitread, conditional write
rCXimplicitread, conditional write
RFLAGSimplicitread

Flags

T tested; blank: not affected. How to read.
DF
All forms
T

Attributes

What else XED records about the forms. How to read.

REP forms
repeated: count in rCX

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.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.
ISA setCPUIDProcessors
I86

No CPUID bit: part of the base instruction set.

Every x86-64 processor in XED’s model and Zen 3 to Zen 6
I386

No CPUID bit: part of the base instruction set.

Every x86-64 processor in XED’s model and Zen 3 to Zen 6
LONGMODE

LM
CPUID.80000001H:EDX[29] LM

Every x86-64 processor in XED’s model and Zen 3 to Zen 6

More General-purpose instructions

All 109 General-purpose instructions

Sources

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s -march feature sets and AMD’s Processor Programming References, which the page of each processor cites.
  3. LLVM 23.1.2's x86 scheduling models (commit 85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them.
  4. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-104 (MOVS/MOVSB/MOVSW/MOVSD/MOVSQ)
  5. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
  6. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 2026)
  7. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.39, October 2026)
  8. Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 2026)
  9. 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.