ld3

Load Multiple 3-Element Structures

LD3 { <Vt1>.<T>, <Vt2>.<T>, <Vt3>.<T> }, [<Xn|SP>]

Loads three-element structures (e.g., RGB) into three registers.

Details

Loads three consecutive 3-element SIMD structures from memory, de-interleaving them into three registers (Vt1, Vt2, Vt3). The element type T and Q field control the 64-bit (Q=0) or 128-bit (Q=1) load size per register; the base address in Xn is post-incremented by the total bytes loaded. This AArch64 NEON instruction does not modify condition flags.

Pseudocode Operation

elements_per_struct ← 3; element_size ← GetElementSize(T); struct_bytes ← 3 * elements_per_struct * element_size; mem_addr ← Xn; (Vt1, Vt2, Vt3) ← DeinterleaveLoad(mem_addr, struct_bytes, Q); Xn ← Xn + struct_bytes;

Example

LD3 [x1]

Encoding

Binary Layout
0
Q
0011000
1
000000
0100
size
Rn
Rt
 
Format SIMD Load/Store
Opcode 0x0C404000
Extension NEON (SIMD)

Operands

  • Vt1
    R
  • Vt2
    G
  • Vt3
    B
  • Xn
    First source / base 64-bit integer register

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x0C404000 LD3 { <Vt>.<T>, <Vt2>.<T>, <Vt3>.<T> }, [<Xn|SP>] A64 0 | Q | 0011000 | 1 | 000000 | 0100 | size | Rn | Rt
0x0CDF4000 LD3 { <Vt>.<T>, <Vt2>.<T>, <Vt3>.<T> }, [<Xn|SP>], <imm> A64 0 | Q | 0011001 | 1 | 0 | 11111 | 0100 | size | Rn | Rt
0x0CC04000 LD3 { <Vt>.<T>, <Vt2>.<T>, <Vt3>.<T> }, [<Xn|SP>], <Xm> A64 0 | Q | 0011001 | 1 | 0 | Rm | 0100 | size | Rn | Rt
0x0D402000 LD3 { <Vt>.B, <Vt2>.B, <Vt3>.B }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 1 | 0 | 0000 | 0 | 001 | S | size | Rn | Rt
0x0D406000 LD3 { <Vt>.H, <Vt2>.H, <Vt3>.H }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 1 | 0 | 0000 | 0 | 011 | S | size | Rn | Rt
0x0D40A000 LD3 { <Vt>.S, <Vt2>.S, <Vt3>.S }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 1 | 0 | 0000 | 0 | 101 | S | 00 | Rn | Rt
0x0D40A400 LD3 { <Vt>.D, <Vt2>.D, <Vt3>.D }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 1 | 0 | 0000 | 0 | 101 | 0 | 01 | Rn | Rt
0x0DDF2000 LD3 { <Vt>.B, <Vt2>.B, <Vt3>.B }[<index>], [<Xn|SP>], #3 A64 0 | Q | 0011011 | 1 | 0 | 11111 | 001 | S | size | Rn | Rt
0x0DC02000 LD3 { <Vt>.B, <Vt2>.B, <Vt3>.B }[<index>], [<Xn|SP>], <Xm> A64 0 | Q | 0011011 | 1 | 0 | Rm | 001 | S | size | Rn | Rt
0x0DDF6000 LD3 { <Vt>.H, <Vt2>.H, <Vt3>.H }[<index>], [<Xn|SP>], #6 A64 0 | Q | 0011011 | 1 | 0 | 11111 | 011 | S | size | Rn | Rt
0x0DC06000 LD3 { <Vt>.H, <Vt2>.H, <Vt3>.H }[<index>], [<Xn|SP>], <Xm> A64 0 | Q | 0011011 | 1 | 0 | Rm | 011 | S | size | Rn | Rt
0x0DDFA000 LD3 { <Vt>.S, <Vt2>.S, <Vt3>.S }[<index>], [<Xn|SP>], #12 A64 0 | Q | 0011011 | 1 | 0 | 11111 | 101 | S | 00 | Rn | Rt
0x0DC0A000 LD3 { <Vt>.S, <Vt2>.S, <Vt3>.S }[<index>], [<Xn|SP>], <Xm> A64 0 | Q | 0011011 | 1 | 0 | Rm | 101 | S | 00 | Rn | Rt
0x0DDFA400 LD3 { <Vt>.D, <Vt2>.D, <Vt3>.D }[<index>], [<Xn|SP>], #24 A64 0 | Q | 0011011 | 1 | 0 | 11111 | 101 | 0 | 01 | Rn | Rt

Description

Load multiple 3-element structures to three registers. This instruction loads multiple 3-element structures from memory and writes the result to the three SIMD&FP registers, with de-interleaving. Depending on the settings in the CPACR_EL1, CPTR_EL2, and CPTR_EL3 registers, and the current Security state and Exception level, an attempt to execute the instruction might be trapped.

Operation

CheckFPAdvSIMDEnabled64();

bits(64) address;
bits(64) eaddr;
bits(64) offs;
bits(datasize) rval;
integer tt;
constant integer ebytes = esize DIV 8;

AccessDescriptor accdesc = CreateAccDescASIMD(memop, nontemporal, tagchecked);
if n == 31 then
    CheckSPAlignment();
    address = SP[];
else
    address = X[n, 64];

offs = Zeros(64);
for r = 0 to rpt-1
    for e = 0 to elements-1
        tt = (t + r) MOD 32;
        for s = 0 to selem-1
            rval = V[tt, datasize];
            eaddr = GenerateAddress(address, offs, accdesc);
            if memop == MemOp_LOAD then
                Elem[rval, e, esize] = Mem[eaddr, ebytes, accdesc];
                V[tt, datasize] = rval;
            else // memop == MemOp_STORE
                Mem[eaddr, ebytes, accdesc] = Elem[rval, e, esize];
            offs = offs + ebytes;
            tt = (tt + 1) MOD 32;

if wback then
    if m != 31 then
        offs = X[m, 64];
    address = GenerateAddress(address, offs, accdesc);
    if n == 31 then
        SP[] = address;
    else
        X[n, 64] = address;