st2

Store Multiple 2-Element Structures

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

Stores two-element structures from two registers to memory (Interleave).

Details

Stores two SIMD registers to memory, interleaving their elements into two consecutive 2-element structures. The element type T and Q field determine the 64-bit (Q=0) or 128-bit (Q=1) store size per register; the base address in Xn is post-incremented by the total bytes stored. This AArch64 NEON instruction does not modify condition flags.

Pseudocode Operation

elements_per_struct ← 2; element_size ← GetElementSize(T); struct_bytes ← 2 * elements_per_struct * element_size; mem_addr ← Xn; InterleavedData ← InterleaveStore(Vt1, Vt2, Q); [mem_addr] ← InterleavedData; Xn ← Xn + struct_bytes;

Example

ST2 [x1]

Encoding

Binary Layout
0
Q
0011000
0
000000
1000
size
Rn
Rt
 
Format SIMD Load/Store
Opcode 0x0C008000
Extension NEON (SIMD)

Operands

  • Vt1
    First transfer SIMD/FP register (load/store)
  • Vt2
    Second transfer SIMD/FP register (load/store)
  • Xn
    First source / base 64-bit integer register

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x0C008000 ST2 { <Vt>.<T>, <Vt2>.<T> }, [<Xn|SP>] A64 0 | Q | 0011000 | 0 | 000000 | 1000 | size | Rn | Rt
0x0C9F8000 ST2 { <Vt>.<T>, <Vt2>.<T> }, [<Xn|SP>], <imm> A64 0 | Q | 0011001 | 0 | 0 | 11111 | 1000 | size | Rn | Rt
0x0C808000 ST2 { <Vt>.<T>, <Vt2>.<T> }, [<Xn|SP>], <Xm> A64 0 | Q | 0011001 | 0 | 0 | Rm | 1000 | size | Rn | Rt
0x0D200000 ST2 { <Vt>.B, <Vt2>.B }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 0 | 1 | 0000 | 0 | 000 | S | size | Rn | Rt
0x0D204000 ST2 { <Vt>.H, <Vt2>.H }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 0 | 1 | 0000 | 0 | 010 | S | size | Rn | Rt
0x0D208000 ST2 { <Vt>.S, <Vt2>.S }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 0 | 1 | 0000 | 0 | 100 | S | 00 | Rn | Rt
0x0D208400 ST2 { <Vt>.D, <Vt2>.D }[<index>], [<Xn|SP>] A64 0 | Q | 0011010 | 0 | 1 | 0000 | 0 | 100 | 0 | 01 | Rn | Rt
0x0DBF0000 ST2 { <Vt>.B, <Vt2>.B }[<index>], [<Xn|SP>], #2 A64 0 | Q | 0011011 | 0 | 1 | 11111 | 000 | S | size | Rn | Rt
0x0DA00000 ST2 { <Vt>.B, <Vt2>.B }[<index>], [<Xn|SP>], <Xm> A64 0 | Q | 0011011 | 0 | 1 | Rm | 000 | S | size | Rn | Rt
0x0DBF4000 ST2 { <Vt>.H, <Vt2>.H }[<index>], [<Xn|SP>], #4 A64 0 | Q | 0011011 | 0 | 1 | 11111 | 010 | S | size | Rn | Rt
0x0DA04000 ST2 { <Vt>.H, <Vt2>.H }[<index>], [<Xn|SP>], <Xm> A64 0 | Q | 0011011 | 0 | 1 | Rm | 010 | S | size | Rn | Rt
0x0DBF8000 ST2 { <Vt>.S, <Vt2>.S }[<index>], [<Xn|SP>], #8 A64 0 | Q | 0011011 | 0 | 1 | 11111 | 100 | S | 00 | Rn | Rt
0x0DA08000 ST2 { <Vt>.S, <Vt2>.S }[<index>], [<Xn|SP>], <Xm> A64 0 | Q | 0011011 | 0 | 1 | Rm | 100 | S | 00 | Rn | Rt
0x0DBF8400 ST2 { <Vt>.D, <Vt2>.D }[<index>], [<Xn|SP>], #16 A64 0 | Q | 0011011 | 0 | 1 | 11111 | 100 | 0 | 01 | Rn | Rt

Description

Store multiple 2-element structures from two registers. This instruction stores multiple 2-element structures from two SIMD&FP registers to memory, with interleaving. Every element of each register is stored. 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;