Extensions
Forms
7 (7 Legacy)
Data
Intel XED v2026.08.23

MOVSX reads a signed byte or word and writes it to a wider register, filling the bits above it with copies of its sign bit. It is how compiled code loads signed char and short values: GCC 14 and Clang 23 at -O2 compile a read of *p, with p a short *, to movsx eax, word ptr [rdi] for an int result and to movsx rax, word ptr [rdi] for a long. MOVZX fills with zeros instead.

From 32 to 64 bits

No MOVSX takes a 32-bit source. Widening an int to 64 bits is MOVSXD, which GCC and Clang both print as movsxd rax, edi; CDQE does the same for EAX alone in two bytes, and both compilers use it on an int that a call returned. The everyday case is an int array index: a[i] needs i sign-extended before it can enter a 64-bit address, where an unsigned index needs only a 32-bit MOV such as mov esi, esi.

Who extends a small argument

For int f(short s) { return s; }, GCC emits movsx eax, di, while Clang emits a plain mov eax, edi and trusts the caller to have extended the argument; the System V page explains why that holds in practice but is not promised. Plain char is signed on x86-64 (sizes of C types), and both compilers treat it the same way.

Sizes

  • A 32-bit destination clears bits 63:32, so movsx eax, byte ptr [rdi] leaves a negative byte as a positive 64-bit value; a long result needs the 64-bit destination. A 16-bit destination keeps bits 63:16, like any 16-bit write.
  • A word source with a 16-bit destination has nothing to extend: it copies the word.
  • GNU’s AT&T syntax names both sizes, source first: movsbw, movsbl, movsbq, movswl, movswq, and movslq for MOVSXD.

Instead of a byte or word MOV

A MOV into AL or AX merges the new bits with the rest of the register, so later readers wait for both; MOVSX into a 32- or 64-bit register replaces it whole. Intel’s optimization manual uses MOVSX that way to break such a dependency (Section 13.2.5). It also counts MOVSX among the register moves that Ivy Bridge cannot eliminate, where MOVZX from a low byte register qualifies (Example 3-21), and its Coding Rule 34 prefers zero extension where either will do.

Forms

Every encoding of MOVSX that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
MOVSX r16/32/64, m8 MOVSX_GPRv_MEMb0F BE /rBase instruction set
MOVSX r16/32/64, m16 not in 64-bit mode MOVSX_GPRv_MEMw0F BF /rBase instruction set
MOVSX r64, m16 64-bit mode only MOVSX_GPR64_MEMwREX.W 0F BF /rBase instruction set
MOVSX r16, m16 64-bit mode only MOVSX_GPR16_MEMw66 0F BF /rBase instruction set
MOVSX r32, m16 64-bit mode only MOVSX_GPR32_MEMw0F BF /rBase instruction set
MOVSX r16/32/64, r8 MOVSX_GPRv_GPR80F BE /rBase instruction set
MOVSX r16/32/64, r16 MOVSX_GPRv_GPR160F BF /rBase instruction set

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.
Modelr16, m8r32, m8
r64, m8
r64, m16
r32, m16
r16, r8r32, r8
r64, r8
r32, r16
r64, r16
Sandy Bridge5 / 0.5p235 / 0.5p231 / 0.33p0151 / 0.33p015
Haswell, Broadwell, Skylake, Skylake-SP, Ice Lake5 / 0.5p235 / 0.5p231 / 0.25p01561 / 0.25p0156
Alder Lake, Sapphire Rapids6 / 0.33p1 p5 p116 / 0.33p2 p3 p101 / 0.33p1 p5 p111 / 0.33p1 p5 p11
Lunar Lake6 / 0.33p1356 / 0.33p20 p21 p221 / 0.33p1351 / 0.33p135
Bonnell3 / 1.5p11 / 1p02 / 1p011 / 1p0
Silvermont3 / 1MEC3 / 1MEC1 / 0.5IEC0 IEC11 / 0.5IEC0 IEC1
Piledriver5 / 1AGLU01 Load5 / 1AGLU01 Load1 / 1EX0 EX11 / 1EX0 EX1
Zen4 / 0.5AGU0 AGU14 / 0.5AGU0 AGU11 / 0.25ALU0 ALU1 ALU2 ALU31 / 0.25ALU0 ALU1 ALU2 ALU3
Zen 24 / 0.33AGU0 AGU1 AGU24 / 0.33AGU0 AGU1 AGU21 / 0.25ALU0 ALU1 ALU2 ALU31 / 0.25ALU0 ALU1 ALU2 ALU3
Zen 3, Zen 45 / 1AGU0 AGU1 AGU2 LSU Load5 / 0.33AGU0 AGU1 AGU2 LSU Load1 / 1ALU0 ALU1 ALU2 ALU31 / 0.25ALU0 ALU1 ALU2 ALU3
Jaguar3 / 1LAGU3 / 1LAGU1 / 0.5ALU0 ALU11 / 0.5ALU0 ALU1

Operation

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

dest.write(sext(src))            # from 8 or 16 bits to OSIZE: a 16-bit
                                 # register keeps bits 63:16, a 32-bit one
                                 # gets bits 63:32 cleared
# MOVSX r16, r/m16 has nothing to extend: it copies the word

Run on AMD Zen 5 (EPYC 9645): 90 cases. The forms that 64-bit mode lacks were not run: the probe runs in 64-bit mode.

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
MOVSX r16/32/64, r/m8 MOVSX r16/32/64, m16 not in 64-bit mode MOVSX r16, m16 64-bit mode only MOVSX r32, m16 64-bit mode only MOVSX r64, m16 64-bit mode only
r16/32/64explicitwrite
r/m8, m16explicitread
MOVSX r16/32/64, r16
r16/32/64explicitwrite
r16explicitread

Flags

None: XED records no flag that the forms test or change.

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
I386

No CPUID bit: part of the base instruction set.

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-120 (MOVSX/MOVSXD)
  5. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.39, October 2026)
  6. Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 2026)

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.