<?xml version="1.0" ?><?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-2026 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="CMN_r" title="CMN (register) -- AArch32" type="instruction">
  <docvars>
    <docvar key="instr-class" value="general"/>
    <docvar key="mnemonic" value="CMN"/>
  </docvars>
  <heading>CMN (register)</heading>
  <desc>
    <brief>
      <para>Compare Negative (register)</para>
    </brief>
    <authored>
      <para>Compare Negative (register) adds a register value and an
optionally-shifted register value. It updates the condition flags
based on the result, and discards the result.</para>
    </authored>
    <encodingnotes>
      <para>For more information about the <arm-defined-word>CONSTRAINED UNPREDICTABLE</arm-defined-word> behavior, 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>
    <classesintro count="3">
      <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> and </txt>
      <a href="#iclass_t2">T2</a>
      <txt>)</txt>
      <txt>.</txt>
    </classesintro>
    <iclass name="A1" oneof="3" id="iclass_a1" no_encodings="2" isa="A32">
      <docvars>
        <docvar key="armarmheading" value="A1"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="A32"/>
        <docvar key="mnemonic" value="CMN"/>
      </docvars>
      <iclassintro count="2"/>
      <regdiagram form="32" psname="A32.dp.dpregis.intdp2reg_immsh.CMN_r_A1_RRX" 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="5" settings="5">
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="22" width="2" name="opc" usename="1" settings="2" psbits="xx">
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="20" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="19" width="4" name="Rn" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="15" width="4" settings="4">
          <c>(0)</c>
          <c>(0)</c>
          <c>(0)</c>
          <c>(0)</c>
        </box>
        <box hibit="11" width="5" name="imm5" usename="1">
          <c colspan="5"/>
        </box>
        <box hibit="6" width="2" name="stype" usename="1">
          <c colspan="2"/>
        </box>
        <box hibit="4" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="3" width="4" name="Rm" usename="1">
          <c colspan="4"/>
        </box>
      </regdiagram>
      <encoding name="CMN_r_A1_RRX" oneofinclass="2" oneof="5" label="Rotate right with extend" bitdiffs="imm5 == 00000 &amp;&amp; stype == 11">
        <docvars>
          <docvar key="armarmheading" value="A1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A32"/>
          <docvar key="mnemonic-shift-type" value="CMN-rrx"/>
          <docvar key="shift-type" value="rrx"/>
          <docvar key="mnemonic" value="CMN"/>
        </docvars>
        <box hibit="11" width="5" name="imm5">
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="6" width="2" name="stype">
          <c>1</c>
          <c>1</c>
        </box>
        <asmtemplate><text>CMN{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="c__5">&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="For the &quot;A1 Rotate right with extend&quot; and &quot;A1 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field. The PC can be used, but this is deprecated." link="Rn__2">&lt;Rn&gt;</a><text>, </text><a hover="For the &quot;A1 Rotate right with extend&quot; and &quot;A1 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field. The PC can be used, but this is deprecated." link="Rm__4">&lt;Rm&gt;</a><text>, RRX</text></asmtemplate>
      </encoding>
      <encoding name="CMN_r_A1" oneofinclass="2" oneof="5" label="Shift or rotate by value" bitdiffs="!(imm5 == 00000 &amp;&amp; stype == 11)">
        <docvars>
          <docvar key="armarmheading" value="A1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A32"/>
          <docvar key="mnemonic-shift-type" value="CMN-shift-no-rrx"/>
          <docvar key="shift-type" value="shift-no-rrx"/>
          <docvar key="mnemonic" value="CMN"/>
        </docvars>
        <asmtemplate><text>CMN{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="c__5">&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="For the &quot;A1 Rotate right with extend&quot; and &quot;A1 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field. The PC can be used, but this is deprecated." link="Rn__2">&lt;Rn&gt;</a><text>, </text><a hover="For the &quot;A1 Rotate right with extend&quot; and &quot;A1 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field. The PC can be used, but this is deprecated." link="Rm__4">&lt;Rm&gt;</a><text> {, </text><a hover="Is the type of shift to be applied to the second source register, " link="shift_option__5">&lt;shift&gt;</a><text> #</text><a hover="For the &quot;A1 Shift or rotate by value&quot; variant: is the shift amount, in the range 1 to 31 (when &lt;shift&gt; = LSL or ROR) or 1 to 32 (when &lt;shift&gt; = LSR or ASR) encoded in the &quot;imm5&quot; field as &lt;amount&gt; modulo 32." link="amount__2">&lt;amount&gt;</a><text>}</text></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A32.dp.dpregis.intdp2reg_immsh.CMN_r_A1_RRX" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let n : integer = UInt(Rn);
let m : integer = UInt(Rm);
let (shift_t, shift_n) : (<a link="type_SRType" file="shared_pseudocode.xml">SRType</a>, integer) = <a link="func_DecodeImmShift_2" file="shared_pseudocode.xml">DecodeImmShift</a>(stype, imm5);</pstext></ps>
      </ps_section>
    </iclass>
    <iclass name="T1" oneof="3" 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="CMN"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="16" psname="T32.n.dpint16_2l.CMN_r_T1" tworows="1">
        <box hibit="15" width="6" settings="6">
          <c>0</c>
          <c>1</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="9" width="4" name="op" usename="1" settings="4" psbits="xxxx">
          <c>1</c>
          <c>0</c>
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="5" width="3" name="Rm" usename="1">
          <c colspan="3"/>
        </box>
        <box hibit="2" width="3" name="Rn" usename="1">
          <c colspan="3"/>
        </box>
      </regdiagram>
      <encoding name="CMN_r_T1" oneofinclass="1" oneof="5" label="">
        <docvars>
          <docvar key="armarmheading" value="T1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic" value="CMN"/>
        </docvars>
        <asmtemplate><text>CMN{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="c__5">&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="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field." link="Rn__37">&lt;Rn&gt;</a><text>, </text><a hover="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field." link="Rm__19">&lt;Rm&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.n.dpint16_2l.CMN_r_T1" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let n : integer = UInt(Rn);
let m : integer = UInt(Rm);
let shift_t : <a link="type_SRType" file="shared_pseudocode.xml">SRType</a> = <a link="enum_SRType_LSL" file="shared_pseudocode.xml">SRType_LSL</a>;
let shift_n : integer = 0;</pstext></ps>
      </ps_section>
    </iclass>
    <iclass name="T2" oneof="3" id="iclass_t2" no_encodings="2" isa="T32">
      <docvars>
        <docvar key="armarmheading" value="T2"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="T32"/>
        <docvar key="mnemonic" value="CMN"/>
      </docvars>
      <iclassintro count="2"/>
      <regdiagram form="16x2" psname="T32.w.dpint_shiftr.CMN_r_T2_RRX" tworows="1">
        <box hibit="31" width="7" settings="7">
          <c>1</c>
          <c>1</c>
          <c>1</c>
          <c>0</c>
          <c>1</c>
          <c>0</c>
          <c>1</c>
        </box>
        <box hibit="24" width="4" name="op1" usename="1" settings="4" psbits="xxxx">
          <c>1</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="20" name="S" usename="1" settings="1" psbits="x">
          <c>1</c>
        </box>
        <box hibit="19" width="4" name="Rn" usename="1">
          <c colspan="4"/>
        </box>
        <box hibit="15" width="1" settings="1">
          <c>(0)</c>
        </box>
        <box hibit="14" width="3" name="imm3" usename="1">
          <c colspan="3"/>
        </box>
        <box hibit="11" 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="7" width="2" name="imm2" usename="1">
          <c colspan="2"/>
        </box>
        <box hibit="5" width="2" name="stype" usename="1">
          <c colspan="2"/>
        </box>
        <box hibit="3" width="4" name="Rm" usename="1">
          <c colspan="4"/>
        </box>
      </regdiagram>
      <encoding name="CMN_r_T2_RRX" oneofinclass="2" oneof="5" label="Rotate right with extend" bitdiffs="imm3 == 000 &amp;&amp; imm2 == 00 &amp;&amp; stype == 11">
        <docvars>
          <docvar key="armarmheading" value="T2"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic" value="CMN"/>
          <docvar key="mnemonic-shift-type" value="CMN-rrx"/>
          <docvar key="shift-type" value="rrx"/>
        </docvars>
        <box hibit="14" width="3" name="imm3">
          <c>0</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="7" width="2" name="imm2">
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="5" width="2" name="stype">
          <c>1</c>
          <c>1</c>
        </box>
        <asmtemplate><text>CMN{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="c__5">&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="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field." link="Rn__37">&lt;Rn&gt;</a><text>, </text><a hover="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field." link="Rm__19">&lt;Rm&gt;</a><text>, RRX</text></asmtemplate>
      </encoding>
      <encoding name="CMN_r_T2" oneofinclass="2" oneof="5" label="Shift or rotate by value" bitdiffs="!(imm3 == 000 &amp;&amp; imm2 == 00 &amp;&amp; stype == 11)">
        <docvars>
          <docvar key="armarmheading" value="T2"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic-shift-type" value="CMN-shift-no-rrx"/>
          <docvar key="shift-type" value="shift-no-rrx"/>
          <docvar key="mnemonic" value="CMN"/>
        </docvars>
        <asmtemplate><text>CMN{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="c__5">&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="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field." link="Rn__37">&lt;Rn&gt;</a><text>, </text><a hover="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field." link="Rm__19">&lt;Rm&gt;</a><text> {, </text><a hover="Is the type of shift to be applied to the second source register, " link="shift_option__5">&lt;shift&gt;</a><text> #</text><a hover="For the &quot;T2 Shift or rotate by value&quot; variant: is the shift amount, in the range 1 to 31 (when &lt;shift&gt; = LSL or ROR) or 1 to 32 (when &lt;shift&gt; = LSR or ASR), encoded in the &quot;imm3:imm2&quot; field as &lt;amount&gt; modulo 32." link="imm3_imm2">&lt;amount&gt;</a><text>}</text></asmtemplate>
        <asmtemplate comment="&lt;Rn&gt;, &lt;Rm&gt; can be represented in T1"><text>CMN{</text><a hover="See x[Standard assembler syntax fields](Babbefhf)." link="c__5">&lt;c&gt;</a><text>}.W  </text><a hover="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field." link="Rn__37">&lt;Rn&gt;</a><text>, </text><a hover="For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field." link="Rm__19">&lt;Rm&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.w.dpint_shiftr.CMN_r_T2_RRX" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let n : integer = UInt(Rn);
let m : integer = UInt(Rm);
let (shift_t, shift_n) : (<a link="type_SRType" file="shared_pseudocode.xml">SRType</a>, integer) = <a link="func_DecodeImmShift_2" file="shared_pseudocode.xml">DecodeImmShift</a>(stype, imm3::imm2);
// Armv8-A removes UNPREDICTABLE for R13
if n == 15 || m == 15 then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="CMN_r_A1_RRX, CMN_r_A1, CMN_r_T1, CMN_r_T2_RRX, CMN_r_T2, T2B_CMN_r_T2" symboldefcount="1">
      <symbol link="c__5">&lt;c&gt;</symbol>
      <account encodedin="cond">
        <intro>
          <para>See <xref linkend="Babbefhf">Standard assembler syntax fields</xref>.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="CMN_r_A1_RRX, CMN_r_A1, CMN_r_T1, CMN_r_T2_RRX, CMN_r_T2" 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="CMN_r_A1_RRX, CMN_r_A1" symboldefcount="1">
      <symbol link="Rn__2">&lt;Rn&gt;</symbol>
      <account encodedin="Rn">
        <intro>
          <para>For the &quot;A1 Rotate right with extend&quot; and &quot;A1 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field. The PC can be used, but this is deprecated.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="CMN_r_T1, CMN_r_T2_RRX, CMN_r_T2, T2B_CMN_r_T2" symboldefcount="2">
      <symbol link="Rn__37">&lt;Rn&gt;</symbol>
      <account encodedin="Rn">
        <intro>
          <para>For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the first general-purpose source register, encoded in the &quot;Rn&quot; field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="CMN_r_A1_RRX, CMN_r_A1" symboldefcount="1">
      <symbol link="Rm__4">&lt;Rm&gt;</symbol>
      <account encodedin="Rm">
        <intro>
          <para>For the &quot;A1 Rotate right with extend&quot; and &quot;A1 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field. The PC can be used, but this is deprecated.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="CMN_r_T1, CMN_r_T2_RRX, CMN_r_T2, T2B_CMN_r_T2" symboldefcount="2">
      <symbol link="Rm__19">&lt;Rm&gt;</symbol>
      <account encodedin="Rm">
        <intro>
          <para>For the &quot;T1&quot;, &quot;T2 Rotate right with extend&quot;, and &quot;T2 Shift or rotate by value&quot; variants: is the second general-purpose source register, encoded in the &quot;Rm&quot; field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="CMN_r_A1, CMN_r_T2" symboldefcount="1">
      <symbol link="shift_option__5">&lt;shift&gt;</symbol>
      <definition encodedin="stype">
        <intro>Is the type of shift to be applied to the second source register, </intro>
        <table class="valuetable">
          <tgroup cols="2">
            <thead>
              <row>
                <entry class="bitfield">stype</entry>
                <entry class="symbol">&lt;shift&gt;</entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry class="bitfield">00</entry>
                <entry class="symbol">LSL</entry>
              </row>
              <row>
                <entry class="bitfield">01</entry>
                <entry class="symbol">LSR</entry>
              </row>
              <row>
                <entry class="bitfield">10</entry>
                <entry class="symbol">ASR</entry>
              </row>
              <row>
                <entry class="bitfield">11</entry>
                <entry class="symbol">ROR</entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </definition>
    </explanation>
    <explanation enclist="CMN_r_A1" symboldefcount="1">
      <symbol link="amount__2">&lt;amount&gt;</symbol>
      <account encodedin="imm5">
        <intro>
          <para>For the &quot;A1 Shift or rotate by value&quot; variant: is the shift amount, in the range 1 to 31 (when &lt;shift&gt; = LSL or ROR) or 1 to 32 (when &lt;shift&gt; = LSR or ASR) encoded in the &quot;imm5&quot; field as &lt;amount&gt; modulo 32.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="CMN_r_T2" symboldefcount="2">
      <symbol link="imm3_imm2">&lt;amount&gt;</symbol>
      <account encodedin="(imm3 :: imm2)">
        <intro>
          <para>For the &quot;T2 Shift or rotate by value&quot; variant: is the shift amount, in the range 1 to 31 (when &lt;shift&gt; = LSL or ROR) or 1 to 32 (when &lt;shift&gt; = LSR or ASR), encoded in the &quot;imm3:imm2&quot; field as &lt;amount&gt; modulo 32.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A32.dp.dpregis.intdp2reg_immsh.CMN_r_A1_RRX" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">if <a link="func_ConditionPassed_0" file="shared_pseudocode.xml">ConditionPassed</a>() then
    EncodingSpecificOperations();
    let shifted : bits(32) = Shift{}(<a link="accessor_R_1" file="shared_pseudocode.xml">R</a>(m), shift_t, shift_n, <a link="global_PSTATE" file="shared_pseudocode.xml">PSTATE</a>.C);
    let (result, nzcv) : (bits(32), bits(4)) = <a link="func_AddWithCarry_4" file="shared_pseudocode.xml">AddWithCarry</a>{32}(<a link="accessor_R_1" file="shared_pseudocode.xml">R</a>(n), shifted, '0');
    PSTATE.[N,Z,C,V] = nzcv;
end;</pstext></ps>
  </ps_section>
  <timestamp>2026-03-26 20:27:25</timestamp>
  <commit_id>2026-03_rel</commit_id>
</instructionsection>