<?xml-stylesheet type="text/xsl" encoding="UTF-8" href="iform.xsl" version="1.0"?>
<!DOCTYPE instructionsection PUBLIC "-//ARM//DTD instructionsection //EN" "iform-p.dtd">
<!-- Copyright (c) 2010-2025 Arm Limited or its affiliates. All rights reserved. -->
<!-- This document is Non-Confidential. This document may only be used and distributed in accordance with the terms of the agreement entered into by Arm and the party that Arm delivered this document to. -->
<instructionsection id="STM_u" title="STM (User registers) -- AArch32" type="instruction">
  <docvars>
    <docvar key="armarmheading" value="A1"/>
    <docvar key="instr-class" value="general"/>
    <docvar key="isa" value="A32"/>
    <docvar key="mnemonic" value="STM"/>
  </docvars>
  <heading>STM (User registers)</heading>
  <desc>
    <brief>
      <para>Store Multiple (User registers)</para>
    </brief>
    <authored>
      <para>In an EL1 mode other than System mode, Store Multiple (User
registers) stores multiple User mode registers to consecutive memory
locations using an address from a base register. The PE reads the
base register value normally, using the current mode to determine
the correct Banked version of the register. This instruction cannot
writeback to the base register.</para>
      <para>Store Multiple (User registers) is <arm-defined-word>UNDEFINED</arm-defined-word> in
Hyp mode, and <arm-defined-word>CONSTRAINED UNPREDICTABLE</arm-defined-word> in User
or System modes.</para>
      <para>Armv8.2 permits the deprecation of some Store Multiple ordering behaviors in AArch32 state, for more information see <xref linkend="ARMARM_FEAT_LSMAOC">FEAT_LSMAOC</xref>.</para>
    </authored>
    <encodingnotes>
      <para>For more information about the <arm-defined-word>CONSTRAINED UNPREDICTABLE</arm-defined-word> behavior of this instruction, see <xref linkend="ARMARM_CJAEGDJC">Architectural Constraints on UNPREDICTABLE behaviors</xref>.</para>
    </encodingnotes>
  </desc>
  <operationalnotes>
    <operationalnote>
      <operationalnote_content>
        <para>This instruction is a data-independent-time instruction as described in <xref linkend="ARMARM_BEIIDCEG">About the DIT bit</xref>.</para>
      </operationalnote_content>
    </operationalnote>
  </operationalnotes>
  <alias_list howmany="0"/>
  <classes>
    <iclass name="A1" oneof="1" id="iclass_a1" no_encodings="1" isa="A32">
      <docvars>
        <docvar key="armarmheading" value="A1"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="A32"/>
        <docvar key="mnemonic" value="STM"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="32" psname="A32.brblk.ldstm.STM_u_A1_AS" tworows="1">
        <box hibit="31" width="4" name="cond" usename="1" settings="4" constraint="!= 1111">
          <c colspan="4">!= 1111</c>
        </box>
        <box hibit="27" width="2" settings="2">
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="25" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="24" width="1" name="P" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="23" width="1" name="U" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="22" name="op" usename="1" settings="1" psbits="x">
          <c>1</c>
        </box>
        <box hibit="21" name="W" usename="1" settings="1" psbits="x">
          <c>(0)</c>
        </box>
        <box hibit="20" name="L" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="19" width="4" name="Rn" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="15" width="16" name="register_list" usename="1">
          <c colspan="16"/>
        </box>
      </regdiagram>
      <encoding name="STM_u_A1_AS" oneofinclass="1" oneof="1" label="">
        <docvars>
          <docvar key="armarmheading" value="A1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A32"/>
          <docvar key="mnemonic" value="STM"/>
        </docvars>
        <asmtemplate><text>STM{</text><a hover="is one of:&#10;&#10;&#10;DA&#10;: Decrement After. The consecutive memory addresses end at the address in the base register. Encoded as P = 0, U = 0.&#10;&#10;ED&#10;: Empty Descending. For this instruction, a synonym for DA.&#10;&#10;DB&#10;: Decrement Before. The consecutive memory addresses end one word below the address in the base register. Encoded as P = 1, U = 0.&#10;&#10;FD&#10;: Full Descending. For this instruction, a synonym for DB.&#10;&#10;IA&#10;: Increment After. The consecutive memory addresses start at the address in the base register. This is the default. Encoded as P = 0, U = 1.&#10;&#10;EA&#10;: Empty Ascending. For this instruction, a synonym for IA.&#10;&#10;IB&#10;: Increment Before. The consecutive memory addresses start one word above the address in the base register. Encoded as P = 1, U = 1.&#10;&#10;FA&#10;: Full Ascending. For this instruction, a synonym for IB." link="amode">&lt;amode&gt;</a><text>}{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="cond__2">&lt;c&gt;</a><text>}{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="qw_option">&lt;q&gt;</a><text>}  </text><a hover="Is the general-purpose base register, encoded in the &quot;Rn&quot; field." link="Rn__12">&lt;Rn&gt;</a><text>, </text><a hover="Is a list of one or more registers, separated by commas and surrounded by { and }. It specifies the set of registers to be stored by the STM instruction. The registers are stored with the lowest-numbered register to the lowest memory address, through to the highest-numbered register to the highest memory address. See also x[Encoding of lists of general-purpose registers and the PC](CHDDBEDG)." link="register_list__6">&lt;registers&gt;</a><text>^</text></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A32.brblk.ldstm.STM_u_A1_AS" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let n : integer = UInt(Rn);
let registers : bits(16) = register_list;
let increment : boolean = (U == '1');
let wordhigher : boolean = (P == U);
if n == 15 || BitCount(registers) &lt; 1 then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
      <constrained_unpredictables encoding="A1" ps_block="Decode">
        <cu_case>
          <cu_cause>
            <pstext mayhavelinks="1">BitCount(registers) &lt; 1</pstext></cu_cause>
          <cu_type constraint="Constraint_UNDEF"/>
          <cu_type constraint="Constraint_NOP"/>
          <cu_type>
            <cu_type_text>The instruction operates as an <instruction>STM</instruction> with the same addressing mode but targeting an unspecified set of registers. These registers might include R15.</cu_type_text>
          </cu_type>
        </cu_case>
      </constrained_unpredictables>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="STM_u_A1_AS" symboldefcount="1">
      <symbol link="amode">&lt;amode&gt;</symbol>
      <account encodedin="(U :: P)">
        <intro>
          <para>is one of:</para>
          <list type="param">
            <listitem>
              <param>DA</param>
              <content>Decrement After. The consecutive memory addresses end at the address in the base register. Encoded as P = 0, U = 0.</content>
            </listitem>
            <listitem>
              <param>ED</param>
              <content>Empty Descending. For this instruction, a synonym for <value>DA</value>.</content>
            </listitem>
            <listitem>
              <param>DB</param>
              <content>Decrement Before. The consecutive memory addresses end one word below the address in the base register. Encoded as P = 1, U = 0.</content>
            </listitem>
            <listitem>
              <param>FD</param>
              <content>Full Descending. For this instruction, a synonym for <value>DB</value>.</content>
            </listitem>
            <listitem>
              <param>IA</param>
              <content>Increment After. The consecutive memory addresses start at the address in the base register. This is the default. Encoded as P = 0, U = 1.</content>
            </listitem>
            <listitem>
              <param>EA</param>
              <content>Empty Ascending. For this instruction, a synonym for <value>IA</value>.</content>
            </listitem>
            <listitem>
              <param>IB</param>
              <content>Increment Before. The consecutive memory addresses start one word above the address in the base register. Encoded as P = 1, U = 1.</content>
            </listitem>
            <listitem>
              <param>FA</param>
              <content>Full Ascending. For this instruction, a synonym for <value>IB</value>.</content>
            </listitem>
          </list>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STM_u_A1_AS" symboldefcount="1">
      <symbol link="cond__2">&lt;c&gt;</symbol>
      <account encodedin="cond">
        <intro>
          <para>See <xref linkend="Babbefhf">Standard assembler syntax fields</xref>.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STM_u_A1_AS" symboldefcount="1">
      <symbol link="qw_option">&lt;q&gt;</symbol>
      <account encodedin="">
        <intro>
          <para>See <xref linkend="Babbefhf">Standard assembler syntax fields</xref>.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STM_u_A1_AS" symboldefcount="1">
      <symbol link="Rn__12">&lt;Rn&gt;</symbol>
      <account encodedin="Rn">
        <intro>
          <para>Is the general-purpose base register, encoded in the "Rn" field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="STM_u_A1_AS" symboldefcount="1">
      <symbol link="register_list__6">&lt;registers&gt;</symbol>
      <account encodedin="">
        <intro>
          <para>Is a list of one or more registers, separated by commas and surrounded by { and }. It specifies the set of registers to be stored by the <instruction>STM</instruction> instruction. The registers are stored with the lowest-numbered register to the lowest memory address, through to the highest-numbered register to the highest memory address. See also <xref linkend="CHDDBEDG">Encoding of lists of general-purpose registers and the PC</xref>.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A32.brblk.ldstm.STM_u_A1_AS" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">if ConditionPassed() then
    EncodingSpecificOperations();
    if PSTATE.EL == EL2 then
        Undefined();
    elsif PSTATE.M IN {M32_User,M32_System} then
        UnpredictableProcedure();
    else
        let length : integer = 4*BitCount(registers);
        var address : bits(32) = if increment then R(n) else R(n)-length;
        if wordhigher then address = address+4; end;
        for i = 0 to 14 do
            if registers[i] == '1' then  // Store User mode register
                MemS{32}(address) = Rmode(i, M32_User);
                address = address + 4;
            end;
        end;
        if registers[15] == '1' then
            MemS{32}(address) = PCStoreValue();
        end;
    end;
end;</pstext></ps>
  </ps_section>
  <constrained_unpredictables ps_block="Operation">
    <cu_case>
      <cu_cause>
        <pstext mayhavelinks="1">PSTATE.M IN {M32_User,M32_System}</pstext></cu_cause>
      <cu_type constraint="Constraint_UNDEF"/>
      <cu_type constraint="Constraint_NOP"/>
      <cu_type>
        <cu_type_text>The instruction operates as an <instruction>STM</instruction> with the same addressing mode but targeting an unspecified set of registers. These registers might include R15.</cu_type_text>
      </cu_type>
    </cu_case>
  </constrained_unpredictables>
  <timestamp>2026-03-12 12:23:09</timestamp>
  <commit_id>2025-09_rel_asl1</commit_id>
</instructionsection>
