<?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="MSR_r" title="MSR (register) -- AArch32" type="instruction">
  <docvars>
    <docvar key="instr-class" value="general"/>
    <docvar key="mnemonic" value="MSR"/>
  </docvars>
  <heading>MSR (register)</heading>
  <desc>
    <brief>
      <para>Move general-purpose register to Special register</para>
    </brief>
    <authored>
      <para>Move general-purpose register to Special register moves
selected bits of a general-purpose register to the
<xref linkend="ARMARM_CJAGBHBH">APSR</xref>, <xref linkend="ARMARM_CIHJBHJA">CPSR</xref> or
<xref linkend="ARMARM_CHDDAABB">SPSR</xref>_&lt;current_mode&gt;.</para>
      <para>Because of the Do-Not-Modify nature of its reserved bits, a
read-modify-write sequence is normally required when the <instruction>MSR</instruction>
instruction is being used at Application level and its destination
is not <value>APSR_nzcvq</value> (<value>CPSR_f</value>).</para>
      <para>If an <instruction>MSR</instruction> (register) moves selected bits of an immediate value
to the <xref linkend="ARMARM_CIHJBHJA">CPSR</xref>, the PE checks whether the
value being written to <xref linkend="ARMARM_CHDEDFDC">PSTATE</xref>.M is
legal. See <xref linkend="ARMARM_CHDDFIGE">Illegal changes to PSTATE.M</xref>.</para>
      <para>An <instruction>MSR</instruction> (register) executed in User mode:</para>
      <list type="unordered">
        <listitem>
          <content>Is <arm-defined-word>UNPREDICTABLE</arm-defined-word> if it attempts to update the <xref linkend="ARMARM_CHDDAABB">SPSR</xref>.</content>
        </listitem>
        <listitem>
          <content>Otherwise, does not update any <xref linkend="ARMARM_CIHJBHJA">CPSR</xref> field that is accessible only at EL1 or higher.</content>
        </listitem>
      </list>
      <para>An <instruction>MSR</instruction> (register) executed in System mode is
<arm-defined-word>UNPREDICTABLE</arm-defined-word> if it attempts to update the
<xref linkend="ARMARM_CHDDAABB">SPSR</xref>.</para>
      <para>The <xref linkend="ARMARM_CIHJBHJA">CPSR</xref>.E bit is writable from any mode
using an <instruction>MSR</instruction> instruction.  Arm deprecates using this to change
its value.</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>
  <alias_list howmany="0"/>
  <classes>
    <classesintro count="2">
      <txt>It has encodings from the following instruction sets:</txt>
      <txt> A32 (</txt>
      <a href="#iclass_a1">A1</a>
      <txt>)</txt>
      <txt> and </txt>
      <txt> T32 (</txt>
      <a href="#iclass_t1">T1</a>
      <txt>)</txt>
      <txt>.</txt>
    </classesintro>
    <iclass name="A1" oneof="2" 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="MSR"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="32" psname="A32.dp.dpmisc.movsr_reg.MSR_r_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>0</c>
          <c>0</c>
        </box>
        <box hibit="25" width="3" settings="3">
          <c>0</c>
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="22" width="1" name="R" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="21" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="20" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="19" width="4" name="mask" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="15" width="4" name="Rd" usename="1" settings="4" psbits="xxxx">
          <c>(1)</c>
          <c>(1)</c>
          <c>(1)</c>
          <c>(1)</c>
        </box>
        <box hibit="11" width="2" settings="2">
          <c>(0)</c>
          <c>(0)</c>
        </box>
        <box hibit="9" name="B" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="8" name="m" usename="1" settings="1" psbits="x">
          <c>(0)</c>
        </box>
        <box hibit="7" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="6" width="3" settings="3">
          <c>0</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="3" width="4" name="Rn" usename="1">
          <c colspan="4"/>
        </box>
      </regdiagram>
      <encoding name="MSR_r_A1_AS" oneofinclass="1" oneof="2" label="">
        <docvars>
          <docvar key="armarmheading" value="A1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A32"/>
          <docvar key="mnemonic" value="MSR"/>
        </docvars>
        <asmtemplate><text>MSR{</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 one of:&#10;&#10;&#10;&#10;  * APSR_&lt;bits&gt;.&#10;  * CPSR_&lt;fields&gt;.&#10;  * SPSR_&lt;fields&gt;.&#10;&#10;&#10;For CPSR and SPSR, &lt;fields&gt; is a sequence of one or more of the following:&#10;&#10;&#10;c&#10;: mask&lt;0&gt; = '1' to enable writing of bits&lt;7:0&gt; of the destination PSR.&#10;&#10;x&#10;: mask&lt;1&gt; = '1' to enable writing of bits&lt;15:8&gt; of the destination PSR.&#10;&#10;s&#10;: mask&lt;2&gt; = '1' to enable writing of bits&lt;23:16&gt; of the destination PSR.&#10;&#10;f&#10;: mask&lt;3&gt; = '1' to enable writing of bits&lt;31:24&gt; of the destination PSR.&#10;&#10;&#10;&#10;For APSR, &lt;bits&gt; is one of nzcvq, g, or nzcvqg. These map to the following CPSR_&lt;fields&gt; values:&#10;&#10;&#10;&#10;  * APSR_nzcvq is the same as CPSR_f (mask== '1000').&#10;  * APSR_g is the same as CPSR_s (mask == '0100').&#10;  * APSR_nzcvqg is the same as CPSR_fs (mask == '1100').&#10;&#10;&#10;Arm recommends the APSR_&lt;bits&gt; forms when only the N, Z, C, V, Q, and GE[3:0] bits are being written. For more information, see x[The Application Program Status Register, APSR](CJAGBHBH)." link="spec_reg">&lt;spec_reg&gt;</a><text>, </text><a hover="Is the general-purpose source register, encoded in the &quot;Rn&quot; field." link="Rn__8">&lt;Rn&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A32.dp.dpmisc.movsr_reg.MSR_r_A1_AS" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let n : integer = UInt(Rn);
let write_spsr : boolean = (R == '1');
if mask == '0000' then UnpredictableProcedure(); end;
if n == 15 then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
      <constrained_unpredictables encoding="A1" ps_block="Decode">
        <cu_case>
          <cu_cause>
            <pstext mayhavelinks="1">mask == '0000'</pstext></cu_cause>
          <cu_type constraint="Constraint_UNDEF"/>
          <cu_type constraint="Constraint_NOP"/>
        </cu_case>
      </constrained_unpredictables>
    </iclass>
    <iclass name="T1" oneof="2" id="iclass_t1" no_encodings="1" isa="T32">
      <docvars>
        <docvar key="armarmheading" value="T1"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="T32"/>
        <docvar key="mnemonic" value="MSR"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="16x2" psname="T32.w.bcrtrl.msr_spec.MSR_r_T1_AS">
        <box hibit="31" width="3" settings="3">
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="28" width="2" settings="2">
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="26" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="25" width="4" settings="4">
          <c>1</c>
          <c>1</c>
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="21" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="20" width="1" name="R" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="19" width="4" name="Rn" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="15" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="14" width="3" settings="3">
          <c>0</c>
          <c>(0)</c>
          <c>0</c>
        </box>
        <box hibit="11" width="4" name="mask" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="7" width="2" settings="2">
          <c>(0)</c>
          <c>(0)</c>
        </box>
        <box hibit="5" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="4" width="5" settings="5">
          <c>(0)</c>
          <c>(0)</c>
          <c>(0)</c>
          <c>(0)</c>
          <c>(0)</c>
        </box>
      </regdiagram>
      <encoding name="MSR_r_T1_AS" oneofinclass="1" oneof="2" label="">
        <docvars>
          <docvar key="armarmheading" value="T1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic" value="MSR"/>
        </docvars>
        <asmtemplate><text>MSR{</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 one of:&#10;&#10;&#10;&#10;  * APSR_&lt;bits&gt;.&#10;  * CPSR_&lt;fields&gt;.&#10;  * SPSR_&lt;fields&gt;.&#10;&#10;&#10;For CPSR and SPSR, &lt;fields&gt; is a sequence of one or more of the following:&#10;&#10;&#10;c&#10;: mask&lt;0&gt; = '1' to enable writing of bits&lt;7:0&gt; of the destination PSR.&#10;&#10;x&#10;: mask&lt;1&gt; = '1' to enable writing of bits&lt;15:8&gt; of the destination PSR.&#10;&#10;s&#10;: mask&lt;2&gt; = '1' to enable writing of bits&lt;23:16&gt; of the destination PSR.&#10;&#10;f&#10;: mask&lt;3&gt; = '1' to enable writing of bits&lt;31:24&gt; of the destination PSR.&#10;&#10;&#10;&#10;For APSR, &lt;bits&gt; is one of nzcvq, g, or nzcvqg. These map to the following CPSR_&lt;fields&gt; values:&#10;&#10;&#10;&#10;  * APSR_nzcvq is the same as CPSR_f (mask== '1000').&#10;  * APSR_g is the same as CPSR_s (mask == '0100').&#10;  * APSR_nzcvqg is the same as CPSR_fs (mask == '1100').&#10;&#10;&#10;Arm recommends the APSR_&lt;bits&gt; forms when only the N, Z, C, V, Q, and GE[3:0] bits are being written. For more information, see x[The Application Program Status Register, APSR](CJAGBHBH)." link="spec_reg">&lt;spec_reg&gt;</a><text>, </text><a hover="Is the general-purpose source register, encoded in the &quot;Rn&quot; field." link="Rn__8">&lt;Rn&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.w.bcrtrl.msr_spec.MSR_r_T1_AS" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let n : integer = UInt(Rn);
let write_spsr : boolean = (R == '1');
if mask == '0000' then UnpredictableProcedure(); end;
// Armv8-A removes UNPREDICTABLE for R13
if n == 15 then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
      <constrained_unpredictables encoding="T1" ps_block="Decode">
        <cu_case>
          <cu_cause>
            <pstext mayhavelinks="1">mask == '0000'</pstext></cu_cause>
          <cu_type constraint="Constraint_UNDEF"/>
          <cu_type constraint="Constraint_NOP"/>
        </cu_case>
      </constrained_unpredictables>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="MSR_r_A1_AS, MSR_r_T1_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="MSR_r_A1_AS, MSR_r_T1_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="MSR_r_A1_AS, MSR_r_T1_AS" symboldefcount="1">
      <symbol link="spec_reg">&lt;spec_reg&gt;</symbol>
      <account encodedin="mask">
        <intro>
          <para>Is one of:</para>
          <list type="unordered">
            <listitem>
              <content>
                <value>APSR_&lt;bits&gt;</value>.</content>
            </listitem>
            <listitem>
              <content>
                <value>CPSR_&lt;fields&gt;</value>.</content>
            </listitem>
            <listitem>
              <content>
                <value>SPSR_&lt;fields&gt;</value>.</content>
            </listitem>
          </list>
          <para>For CPSR and SPSR, &lt;fields&gt; is a sequence of one or more of the following:</para>
          <list type="param">
            <listitem>
              <param>c</param>
              <content>mask&lt;0&gt; = '1' to enable writing of bits&lt;7:0&gt; of the destination PSR.</content>
            </listitem>
            <listitem>
              <param>x</param>
              <content>mask&lt;1&gt; = '1' to enable writing of bits&lt;15:8&gt; of the destination PSR.</content>
            </listitem>
            <listitem>
              <param>s</param>
              <content>mask&lt;2&gt; = '1' to enable writing of bits&lt;23:16&gt; of the destination PSR.</content>
            </listitem>
            <listitem>
              <param>f</param>
              <content>mask&lt;3&gt; = '1' to enable writing of bits&lt;31:24&gt; of the destination PSR.</content>
            </listitem>
          </list>
          <para>For APSR, &lt;bits&gt; is one of <value>nzcvq</value>, <value>g</value>, or <value>nzcvqg</value>. These map to the following CPSR_&lt;fields&gt; values:</para>
          <list type="unordered">
            <listitem>
              <content>
                <value>APSR_nzcvq</value> is the same as <value>CPSR_f</value> (mask== '1000').</content>
            </listitem>
            <listitem>
              <content>
                <value>APSR_g</value> is the same as <value>CPSR_s</value> (mask == '0100').</content>
            </listitem>
            <listitem>
              <content>
                <value>APSR_nzcvqg</value> is the same as <value>CPSR_fs</value> (mask == '1100').</content>
            </listitem>
          </list>
          <para>Arm recommends the <value>APSR_&lt;bits&gt;</value> forms when only the N, Z, C, V, Q, and GE[3:0] bits are being written. For more information, see <xref linkend="CJAGBHBH">The Application Program Status Register, APSR</xref>.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="MSR_r_A1_AS, MSR_r_T1_AS" symboldefcount="1">
      <symbol link="Rn__8">&lt;Rn&gt;</symbol>
      <account encodedin="Rn">
        <intro>
          <para>Is the general-purpose source register, encoded in the "Rn" field.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A32.dp.dpmisc.movsr_reg.MSR_r_A1_AS" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">if ConditionPassed() then
    EncodingSpecificOperations();
    if write_spsr then
        if PSTATE.M IN {M32_User,M32_System} then
            UnpredictableProcedure();
        else
            SPSRWriteByInstr(R(n), mask);
        end;
    else
        // Attempts to change to an illegal mode will invoke the Illegal Execution state mechanism
        CPSRWriteByInstr(R(n), mask);
    end;
end;</pstext></ps>
  </ps_section>
  <constrained_unpredictables ps_block="Operation">
    <cu_case>
      <cu_cause>
        <pstext mayhavelinks="1">write_spsr &amp;&amp; PSTATE.M IN {M32_User,M32_System}</pstext></cu_cause>
      <cu_type constraint="Constraint_UNDEF"/>
      <cu_type constraint="Constraint_NOP"/>
    </cu_case>
  </constrained_unpredictables>
  <timestamp>2026-03-12 12:23:09</timestamp>
  <commit_id>2025-09_rel_asl1</commit_id>
</instructionsection>
