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

PALIGNR places the destination above the source to form one value of twice the register’s width, shifts that right by the number of bytes in the immediate, and keeps the low half. With an offset of 5 on XMM registers, the result is bytes 5 to 15 of the source followed by bytes 0 to 4 of the destination. An offset of 16 gives the destination unchanged, larger ones shift in zeros, and from 32 on (16 in the MMX form) the result is zero.

The order is the usual stumbling block. In _mm_alignr_epi8(a, b, n), a is the upper half and b the lower one, so the result starts with byte n of b: the operand that comes second supplies the first bytes.

It is what a byte-granular window over a stream needs:

  • Stitching unaligned data. Code that may only load aligned 16-byte blocks can rebuild the 16 bytes at any offset from two neighboring blocks. Intel’s optimization manual recommends this in place of unaligned loads that would split cache lines (Section 6.3) and builds a memory copy for misaligned sources on it, with one aligned load, one PALIGNR and one aligned store per 16 bytes (Section 15.16.3.1).
  • Sliding windows. Filters that need x[i], x[i+1], x[i+2] and so on in separate registers take each one from two loaded blocks with a different offset; the manual’s FIR filter example does this with offsets of 4, 8 and 12.
  • Rotating bytes. With the same register in both operands, PALIGNR rotates it. Compiling a byte rotation by 3 written with __builtin_shufflevector, GCC 14 and Clang 23 at -O2 emit palignr xmm0, xmm0, 3 once SSSE3 is enabled; for the SSE2 baseline they need PSRLDQ, PSLLDQ and POR.

The legacy SSE form needs a memory operand aligned to 16 bytes. The VEX and EVEX forms, VPALIGNR, work within each 128-bit lane: a 256-bit VPALIGNR is two independent 128-bit ones, and Intel’s optimization manual points out that its memory copy therefore needs an extra load per 32 bytes (Section 15.16.3.1). AVX-512’s VALIGND and VALIGNQ shift across the whole register, in units of doublewords or quadwords.

In the optimization guide

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

Jaguar and Puma

  • Vectors and floating point: The FPU forms three forwarding domains, floating point (FPA and FPM), vector integer (the VALUs and VIMUL) and store and convert, and a result passed from one to another costs a cycle more.

Silvermont to Goldmont Plus

  • Front end: Silvermont decodes SSSE3 and SSE4 instructions that use xmm8 to xmm15 slowly, as they exceed 3 bytes of prefixes and escapes. sources differ
  • Loads, stores and caches: Unaligned vector loads are one micro-op, but line splits are slow; Intel suggests aligned loads and palignr.

Forms

Every encoding of PALIGNR that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
PALIGNR mm, m64, imm8 PALIGNR_MMXq_MEMq_IMMbNP 0F 3A 0F /r ibSSSE3 + MMX
PALIGNR mm, mm, imm8 PALIGNR_MMXq_MMXq_IMMbNP 0F 3A 0F /r ibSSSE3 + MMX
PALIGNR xmm, m128, imm8 PALIGNR_XMMdq_MEMdq_IMMb66 0F 3A 0F /r ibSSSE3
PALIGNR xmm, xmm, imm8 PALIGNR_XMMdq_XMMdq_IMMb66 0F 3A 0F /r ibSSSE3

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.
Modelmm, m64, imm8mm, mm, imm8xmm, m128, imm8xmm, xmm, imm8
Sandy Bridge6 / 0.5p151 / 0.5p157 / 0.5p151 / 0.5p15
Haswell, Skylake, Skylake-SP, Ice Lake6 / 1p51 / 1p57 / 1p51 / 1p5
Broadwell6 / 1p51 / 1p56 / 1p51 / 1p5
Alder Lake, Sapphire Rapids9 / 1p51 / 1p58 / 1p51 / 1p5
Lunar Lake9 / 0.5V2 V31 / 0.5V2 V37 / 2V2 V31 / 0.33p135
Bonnell1 / 1p01 / 1p01 / 1p01 / 1p0
Silvermont4 / 1FPC01 / 1FPC04 / 1FPC01 / 1FPC0
Piledriver7 / 1.5FPU1 FPXBR2 / 1FPU1 FPXBR7 / 1.5FPU1 FPXBR2 / 1FPU1 FPXBR
Zen, Zen 28 / 0.5FPU1 FPU21 / 0.5FPU1 FPU28 / 0.5FPU1 FPU21 / 0.5FPU1 FPU2
Zen 38 / 0.5FP1 FP21 / 0.5FP1 FP28 / 0.5FP1 FP21 / 0.5FP1 FP2
Zen 48 / 0.5FP1 FP21 / 0.5FP1 FP28 / 0.5FP1 FP22 / 0.5FP1 FP2
Jaguar6 / 1FPU0 FPU1 VALU0 VALU11 / 0.5FPU0 FPU1 VALU0 VALU16 / 1FPU0 FPU1 VALU0 VALU11 / 0.5FPU0 FPU1 VALU0 VALU1

Data flow

Where the elements of the sources go, element 0 on the right; results that depend on a control value are drawn for an example. How to read.

Align: xmm1 above xmm2 make one 32-byte value, shifted right by imm8 bytes; the low 16 are the result.
PALIGNR with imm8 = 5With imm8 = 5, result bytes 15 to 0: a4, a3, a2, a1, a0, b15, b14, b13, b12, b11, b10, b9, b8, b7, b6, b5.0123456789101112131415xmm1ab5b6b7b8b9b10b11b12b13b14b15a0a1a2a3a4xmm10123456789101112131415xmm2or m128b

Example: imm8 = 5.

With imm8 = 5, result bytes 15 to 0: a4, a3, a2, a1, a0, b15, b14, b13, b12, b11, b10, b9, b8, b7, b6, b5.

Operation

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

PALIGNR mm, mm/m64, imm8
src1 = mm1.read()  # mm1 as it was
for i in range(8):
    j = i + imm8   # byte j of mm1:src2
    if j < 8:
        x = src2.b[i + imm8]
    elif j < 16:
        x = src1.b[i + imm8 - 8]
    else:
        x = 0
    mm1.b[i] = x
# x87: TOP = 0, all tags valid, bits 79:64 of mm1's register all ones

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

PALIGNR xmm, xmm/m128, imm8
src1 = xmm1.read()  # xmm1 as it was
for i in range(16):
    j = i + imm8    # byte j of xmm1:src2
    if j < 16:
        x = src2.b[i + imm8]
    elif j < 32:
        x = src1.b[i + imm8 - 16]
    else:
        x = 0
    xmm1.b[i] = x
# bits 128 and up of the register are unchanged

Run on AMD Zen 5 (EPYC 9645): 2 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
PALIGNR mm, mm/m64, imm8
mmexplicitread, write
mm/m64explicitread
imm8explicitread
PALIGNR xmm, xmm/m128, imm8
xmmexplicitread, write
xmm/m128explicitread
imm8explicitread

Flags

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

Exceptions

The exception class is XED's name for the set of exception conditions that a form follows. How to read.

PALIGNR mm, mm/m64, imm8
mmx-mem
PALIGNR xmm, xmm/m128, imm8
SSE_TYPE_4

Attributes

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

PALIGNR mm, mm/m64, imm8
may abort a TSX transaction
PALIGNR xmm, m128, imm8
aligned memory operand

Intrinsics

The C intrinsics of Clang 23.1.2 that compile to PALIGNR, each with the form it compiles to and the Clang options it needs. The forms come from compiling every intrinsic and decoding the result with Intel XED; all intrinsics A–Z explains the method.

IntrinsicCompiles to
_mm_alignr_epi8 __m128i _mm_alignr_epi8(__m128i a, __m128i b, const int n)

PALIGNR xmm, xmm, imm8 Legacy -mssse3

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
SSSE3MMX

SSSE3 + MMX
CPUID.01H:ECX[9] SSSE3
CPUID.01H:EDX[23] MMX

XED and Intel’s SDM differ: For the forms on MMX registers that SSE2 added (PADDQ, PMULUDQ and PSUBQ) and those of SSSE3, XED also asks for the MMX bit, CPUID.01H:EDX[23], besides SSE2, CPUID.01H:EDX[26], or SSSE3, CPUID.01H:ECX[9]. Revision 093 of Intel’s SDM names SSE2 or SSSE3 alone for these forms.

Sources: Intel XED v2026.08.23, datafiles/cpuid.xed.txt; Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026), PADDQ, PMULUDQ and PSUBQ: the opcode tables, pages 4-201, 4-395 and 4-487; PABSB/PABSW/PABSD/PABSQ and PSHUFB, pages 4-177 and 4-422, and the entries of the other SSSE3 instructions.

Core (Merom, Conroe), Penryn, Nehalem, Westmere, Sandy Bridge, Ivy Bridge, Haswell, Broadwell, Skylake, Comet Lake, Cannon Lake, Ice Lake (client), Tiger Lake, Alder Lake, Arrow Lake, Panther Lake, Nova Lake, Skylake-SP, Cascade Lake, Cooper Lake, Ice Lake (server), Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Bonnell, Saltwell, Silvermont, Goldmont, Goldmont Plus, Tremont, Snow Ridge, Lakefield, Sierra Forest, Clearwater Forest, Knights Landing, Knights Mill, K10 (Family 10h), Bulldozer, Piledriver, Zen, Zen+, Zen 2, Zen 3, Zen 4, Zen 5, Zen 6
SSSE3

SSSE3
CPUID.01H:ECX[9] SSSE3

Same as SSSE3MMX

Note: XED's AMD_K10 inherits everything from its Westmere chip, including SSSE3, SSE4.1, SSE4.2, AES-NI and PCLMULQDQ; GCC's -march=amdfam10 has none of them.

More SSSE3 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. Clang's x86 intrinsic headers, LLVM 23.1.2 (commit 85ac56026243): the intrinsics, their signatures and doc comments, and the Clang of that release, which compiled each of them.
  4. LLVM 23.1.2's x86 scheduling models (commit 85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them.
  5. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-216 (PALIGNR)
  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 intrinsics and their signatures come from Clang and the timings from LLVM's scheduling models, both part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.