AArch64 NEON TRN/UZP/ZIP Quick Reference

back to blogs

back to home


April 2026

This page is a lookup-first reference for TRN, UZP, and ZIP. The goal is to make the lane movement easy to scan, especially when switching between mixed-source and same-source forms.

Mixed-source notation: vn = [a0 a1 a2 ...], vm = [b0 b1 b2 ...] Same-source notation: v0 = [x0 x1 x2 ...] The same-source case is the mixed-source case with both inputs drawn from the same x-sequence.

How to Use This Page

Start with .4s if you want intuition first. It is the easiest arrangement for seeing how TRN, UZP, and ZIP differ. Use the other sections as lookup tables once that pattern is clear.

At a Glance

TRN takes either the even lanes or the odd lanes, then interleaves them.

UZP takes either the even lanes or the odd lanes, then packs them toward the front.

ZIP takes either the low half or the high half, then interleaves it.


Six Patterns to Memorize

Instruction Mixed-source pattern One-line reading
trn1 [a0 b0 a2 b2 ...] Interleave even lanes.
trn2 [a1 b1 a3 b3 ...] Interleave odd lanes.
uzp1 [a0 a2 ... b0 b2 ...] Extract and pack even lanes.
uzp2 [a1 a3 ... b1 b3 ...] Extract and pack odd lanes.
zip1 [a0 b0 a1 b1 ...] Interleave the low half.
zip2 [aN/2 bN/2 ...] Interleave the high half.

The sections below expand those six patterns for each arrangement in the order .16b, .8h, .4s, and .2d.


.16b

Let
vn.16b = [a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15]
vm.16b = [b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15]
v0.16b = [x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15].

Mixed-source

Instruction Result
trn1 [a0 b0 a2 b2 a4 b4 a6 b6 a8 b8 a10 b10 a12 b12 a14 b14]
trn2 [a1 b1 a3 b3 a5 b5 a7 b7 a9 b9 a11 b11 a13 b13 a15 b15]
uzp1 [a0 a2 a4 a6 a8 a10 a12 a14 b0 b2 b4 b6 b8 b10 b12 b14]
uzp2 [a1 a3 a5 a7 a9 a11 a13 a15 b1 b3 b5 b7 b9 b11 b13 b15]
zip1 [a0 b0 a1 b1 a2 b2 a3 b3 a4 b4 a5 b5 a6 b6 a7 b7]
zip2 [a8 b8 a9 b9 a10 b10 a11 b11 a12 b12 a13 b13 a14 b14 a15 b15]

Same-source

Instruction Result
trn1 [x0 x0 x2 x2 x4 x4 x6 x6 x8 x8 x10 x10 x12 x12 x14 x14]
trn2 [x1 x1 x3 x3 x5 x5 x7 x7 x9 x9 x11 x11 x13 x13 x15 x15]
uzp1 [x0 x2 x4 x6 x8 x10 x12 x14 x0 x2 x4 x6 x8 x10 x12 x14]
uzp2 [x1 x3 x5 x7 x9 x11 x13 x15 x1 x3 x5 x7 x9 x11 x13 x15]
zip1 [x0 x0 x1 x1 x2 x2 x3 x3 x4 x4 x5 x5 x6 x6 x7 x7]
zip2 [x8 x8 x9 x9 x10 x10 x11 x11 x12 x12 x13 x13 x14 x14 x15 x15]

This is the fullest form of the pattern, and it makes the lane rules easiest to see in complete detail.


.8h

Let
vn.8h = [a0 a1 a2 a3 a4 a5 a6 a7]
vm.8h = [b0 b1 b2 b3 b4 b5 b6 b7]
v0.8h = [x0 x1 x2 x3 x4 x5 x6 x7].

Mixed-source

Instruction Result
trn1 [a0 b0 a2 b2 a4 b4 a6 b6]
trn2 [a1 b1 a3 b3 a5 b5 a7 b7]
uzp1 [a0 a2 a4 a6 b0 b2 b4 b6]
uzp2 [a1 a3 a5 a7 b1 b3 b5 b7]
zip1 [a0 b0 a1 b1 a2 b2 a3 b3]
zip2 [a4 b4 a5 b5 a6 b6 a7 b7]

Same-source

Instruction Result
trn1 [x0 x0 x2 x2 x4 x4 x6 x6]
trn2 [x1 x1 x3 x3 x5 x5 x7 x7]
uzp1 [x0 x2 x4 x6 x0 x2 x4 x6]
uzp2 [x1 x3 x5 x7 x1 x3 x5 x7]
zip1 [x0 x0 x1 x1 x2 x2 x3 x3]
zip2 [x4 x4 x5 x5 x6 x6 x7 x7]

This follows the same rule as .16b, just with half as many lanes.


.4s

Let
vn.4s = [a0 a1 a2 a3]
vm.4s = [b0 b1 b2 b3]
v0.4s = [x0 x1 x2 x3].

Mixed-source

Instruction Result
trn1 [a0 b0 a2 b2]
trn2 [a1 b1 a3 b3]
uzp1 [a0 a2 b0 b2]
uzp2 [a1 a3 b1 b3]
zip1 [a0 b0 a1 b1]
zip2 [a2 b2 a3 b3]

Same-source

Instruction Result
trn1 [x0 x0 x2 x2]
trn2 [x1 x1 x3 x3]
uzp1 [x0 x2 x0 x2]
uzp2 [x1 x3 x1 x3]
zip1 [x0 x0 x1 x1]
zip2 [x2 x2 x3 x3]

This is the arrangement that usually gives the cleanest intuition for how the three instruction families differ.


.2d

Let
vn.2d = [a0 a1]
vm.2d = [b0 b1]
v0.2d = [x0 x1].

Mixed-source

Instruction Result
trn1 [a0 b0]
trn2 [a1 b1]
uzp1 [a0 b0]
uzp2 [a1 b1]
zip1 [a0 b0]
zip2 [a1 b1]

Same-source

Instruction Result
trn1 [x0 x0]
trn2 [x1 x1]
uzp1 [x0 x0]
uzp2 [x1 x1]
zip1 [x0 x0]
zip2 [x1 x1]

The key point for .2d: when there are only two lanes, trn1, uzp1, and zip1 all collapse to lane 0, while trn2, uzp2, and zip2 all collapse to lane 1. The arrangement flattens most of the differences away.


One-Line Summary

TRN = split by even / odd lanes, then interleave UZP = split by even / odd lanes, then extract and pack ZIP = split by low half / high half, then interleave