str

Store Register (Register)

STR <Wt>, [<Xn|SP>, <R><m> {, <extend> <amount>}]

Stores a register to memory (Register offset).

Details

Stores a 32-bit register to memory using register-based addressing with optional extension and shift of the offset register. Does not affect condition flags. AArch64-only; supports UXTW, UXTX, SXTW, SXTX extensions with optional left shift.

Pseudocode Operation

offset ← ExtendValue(Rm, option, S)
address ← Xn + offset
[address] ← Wt[31:0]

Example

STR w3, [x1, Rm ]

Encoding

Binary Layout
10
111
0
00
00
1
Rm
option
S
10
Rn
Rt
 
Format Load/Store Reg
Opcode 0xB8200800
Extension Base

Operands

  • Wt
    Transfer 32-bit integer register (load/store)
  • Xn
    First source / base 64-bit integer register
  • Rm
    Offset Reg

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x3C000400 STR <Bt>, [<Xn|SP>], #<simm> A64 00 | 111 | 1 | 00 | 00 | 0 | imm9 | 01 | Rn | Rt
0x7C000400 STR <Ht>, [<Xn|SP>], #<simm> A64 01 | 111 | 1 | 00 | 00 | 0 | imm9 | 01 | Rn | Rt
0xBC000400 STR <St>, [<Xn|SP>], #<simm> A64 10 | 111 | 1 | 00 | 00 | 0 | imm9 | 01 | Rn | Rt
0xFC000400 STR <Dt>, [<Xn|SP>], #<simm> A64 11 | 111 | 1 | 00 | 00 | 0 | imm9 | 01 | Rn | Rt
0x3C800400 STR <Qt>, [<Xn|SP>], #<simm> A64 00 | 111 | 1 | 00 | 10 | 0 | imm9 | 01 | Rn | Rt
0x3C000C00 STR <Bt>, [<Xn|SP>, #<simm>]! A64 00 | 111 | 1 | 00 | 00 | 0 | imm9 | 11 | Rn | Rt
0x7C000C00 STR <Ht>, [<Xn|SP>, #<simm>]! A64 01 | 111 | 1 | 00 | 00 | 0 | imm9 | 11 | Rn | Rt
0xBC000C00 STR <St>, [<Xn|SP>, #<simm>]! A64 10 | 111 | 1 | 00 | 00 | 0 | imm9 | 11 | Rn | Rt
0xFC000C00 STR <Dt>, [<Xn|SP>, #<simm>]! A64 11 | 111 | 1 | 00 | 00 | 0 | imm9 | 11 | Rn | Rt
0x3C800C00 STR <Qt>, [<Xn|SP>, #<simm>]! A64 00 | 111 | 1 | 00 | 10 | 0 | imm9 | 11 | Rn | Rt
0x3D000000 STR <Bt>, [<Xn|SP>{, #<pimm>}] A64 00 | 111 | 1 | 01 | 00 | imm12 | Rn | Rt
0x7D000000 STR <Ht>, [<Xn|SP>{, #<pimm>}] A64 01 | 111 | 1 | 01 | 00 | imm12 | Rn | Rt
0xBD000000 STR <St>, [<Xn|SP>{, #<pimm>}] A64 10 | 111 | 1 | 01 | 00 | imm12 | Rn | Rt
0xFD000000 STR <Dt>, [<Xn|SP>{, #<pimm>}] A64 11 | 111 | 1 | 01 | 00 | imm12 | Rn | Rt

Description

Store Register (register) calculates an address from a base register value and an offset register value, and stores a 32-bit word or a 64-bit doubleword to the calculated address, from a register. For information about memory accesses, see Load/Store addressing modes. The instruction uses an offset addressing mode, that calculates the address used for the memory access from a base register value and an offset register value. The offset can be optionally shifted and extended.

Operation

bits(64) offset = ExtendReg(m, extend_type, shift, 64);
bits(64) address;
bits(datasize) data;

boolean privileged = PSTATE.EL != EL0;
AccessDescriptor accdesc = CreateAccDescGPR(MemOp_STORE, FALSE, privileged, TRUE);

if n == 31 then
    CheckSPAlignment();
    address = SP[];
else
    address = X[n, 64];

address = GenerateAddress(address, offset, accdesc);

data = X[t, datasize];
Mem[address, datasize DIV 8, accdesc] = data;