<?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="B" title="B -- AArch32" type="instruction">
  <docvars>
    <docvar key="instr-class" value="general"/>
    <docvar key="mnemonic" value="B"/>
  </docvars>
  <heading>B</heading>
  <desc>
    <brief>
      <para>Branch</para>
    </brief>
    <authored>
      <para>Branch causes a branch to a target address.</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>
      <para>Related encodings: <xref linkend="ARMARM_T32.encoding_index.bcrtrl">Branches and miscellaneous control</xref>.</para>
    </encodingnotes>
  </desc>
  <alias_list howmany="0"/>
  <classes>
    <classesintro count="5">
      <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>
      <a href="#iclass_t2">T2</a>
      <txt>, </txt>
      <a href="#iclass_t3">T3</a>
      <txt> and </txt>
      <a href="#iclass_t4">T4</a>
      <txt>)</txt>
      <txt>.</txt>
    </classesintro>
    <iclass name="A1" oneof="5" 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="B"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="32" psname="A32.brblk.b_imm.B_A1" 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>1</c>
        </box>
        <box hibit="24" name="H" usename="1" settings="1" psbits="x">
          <c>0</c>
        </box>
        <box hibit="23" width="24" name="imm24" usename="1">
          <c colspan="24"/>
        </box>
      </regdiagram>
      <encoding name="B_A1" oneofinclass="1" oneof="5" label="">
        <docvars>
          <docvar key="armarmheading" value="A1"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A32"/>
          <docvar key="mnemonic" value="B"/>
        </docvars>
        <asmtemplate><text>B{</text><a hover="For the &quot;A1&quot; variant: see x[Standard assembler syntax fields](Babbefhf)." link="cond__3">&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&quot; variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32 to that offset." link="label__2">&lt;label&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A32.brblk.b_imm.B_A1" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let imm32 : bits(32) = SignExtend{}(imm24::'00');</pstext></ps>
      </ps_section>
    </iclass>
    <iclass name="T1" oneof="5" 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="B"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="16" psname="T32.n.brc.bcond16.B_T1" tworows="1">
        <box hibit="15" width="4" settings="4">
          <c>1</c>
          <c>1</c>
          <c>0</c>
          <c>1</c>
        </box>
        <box hibit="11" width="4" name="cond" usename="1" settings="3" psbits="xxxx" constraint="!= 111x">
          <c colspan="4">!= 111x</c>
        </box>
        <box hibit="7" width="8" name="imm8" usename="1">
          <c colspan="8"/>
        </box>
      </regdiagram>
      <encoding name="B_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="B"/>
        </docvars>
        <asmtemplate comment="Not permitted in IT block"><text>B</text><a hover="For the &quot;T1&quot; and &quot;T3&quot; variants: see x[Standard assembler syntax fields](Babbefhf). Must not be AL or omitted." link="cond__6">&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; variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32 to that offset. Permitted offsets are even numbers in the range –256 to 254." link="label__4">&lt;label&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.n.brc.bcond16.B_T1" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">if cond == '1110' then See("UDF"); end;
if cond == '1111' then See("SVC"); end;
let imm32 : bits(32) = SignExtend{}(imm8::'0');
if InITBlock() then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
    </iclass>
    <iclass name="T2" oneof="5" id="iclass_t2" no_encodings="1" isa="T32">
      <docvars>
        <docvar key="armarmheading" value="T2"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="T32"/>
        <docvar key="mnemonic" value="B"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="16" psname="T32.b16.B_T2" tworows="1">
        <box hibit="15" width="3" name="op0" usename="1" settings="3" psbits="xxx">
          <c>1</c>
          <c>1</c>
          <c>1</c>
        </box>
        <box hibit="12" width="2" name="op1" usename="1" settings="2" psbits="xx">
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="10" width="11" name="imm11" usename="1">
          <c colspan="11"/>
        </box>
      </regdiagram>
      <encoding name="B_T2" oneofinclass="1" oneof="5" label="">
        <docvars>
          <docvar key="armarmheading" value="T2"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic" value="B"/>
        </docvars>
        <asmtemplate comment="Outside or last in IT block"><text>B{</text><a hover="For the &quot;T2&quot; and &quot;T4&quot; variants: see x[Standard assembler syntax fields](Babbefhf)." link="AL_option__6">&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;T2&quot; variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32 to that offset. Permitted offsets are even numbers in the range –2048 to 2046." link="label__5">&lt;label&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.b16.B_T2" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let imm32 : bits(32) = SignExtend{}(imm11::'0');
if InITBlock() &amp;&amp; !LastInITBlock() then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
    </iclass>
    <iclass name="T3" oneof="5" id="iclass_t3" no_encodings="1" isa="T32">
      <docvars>
        <docvar key="armarmheading" value="T3"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="T32"/>
        <docvar key="mnemonic" value="B"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="16x2" psname="T32.w.bcrtrl.bcond.B_T3" tworows="1">
        <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" name="S" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="25" width="4" name="cond" usename="1" settings="3" psbits="xxxx" constraint="!= 111x">
          <c colspan="4">!= 111x</c>
        </box>
        <box hibit="21" width="6" name="imm6" usename="1">
          <c colspan="6"/>
        </box>
        <box hibit="15" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="14" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="13" width="1" name="J1" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="12" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="11" width="1" name="J2" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="10" width="11" name="imm11" usename="1">
          <c colspan="11"/>
        </box>
      </regdiagram>
      <encoding name="B_T3" oneofinclass="1" oneof="5" label="">
        <docvars>
          <docvar key="armarmheading" value="T3"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic" value="B"/>
        </docvars>
        <asmtemplate comment="Not permitted in IT block, and &lt;label&gt; can be represented in T1"><text>B</text><a hover="For the &quot;T1&quot; and &quot;T3&quot; variants: see x[Standard assembler syntax fields](Babbefhf). Must not be AL or omitted." link="cond__6">&lt;c&gt;</a><text>.W  </text><a hover="For the &quot;T3&quot; variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32 to that offset." link="S_J2_J1_imm6_imm11">&lt;label&gt;</a></asmtemplate>
        <asmtemplate comment="Not permitted in IT block"><text>B</text><a hover="For the &quot;T1&quot; and &quot;T3&quot; variants: see x[Standard assembler syntax fields](Babbefhf). Must not be AL or omitted." link="cond__6">&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;T3&quot; variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32 to that offset." link="S_J2_J1_imm6_imm11">&lt;label&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.w.bcrtrl.bcond.B_T3" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">if cond[3:1] == '111' then See("Related encodings"); end;
let imm32 : bits(32) = SignExtend{}(S::J2::J1::imm6::imm11::'0');
if InITBlock() then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
    </iclass>
    <iclass name="T4" oneof="5" id="iclass_t4" no_encodings="1" isa="T32">
      <docvars>
        <docvar key="armarmheading" value="T4"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="T32"/>
        <docvar key="mnemonic" value="B"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="16x2" psname="T32.w.bcrtrl.b.B_T4">
        <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" name="S" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="25" width="10" name="imm10" usename="1">
          <c colspan="10"/>
        </box>
        <box hibit="15" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="14" width="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="13" width="1" name="J1" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="12" width="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="11" width="1" name="J2" usename="1">
          <c colspan="1"/>
        </box>
        <box hibit="10" width="11" name="imm11" usename="1">
          <c colspan="11"/>
        </box>
      </regdiagram>
      <encoding name="B_T4" oneofinclass="1" oneof="5" label="">
        <docvars>
          <docvar key="armarmheading" value="T4"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="T32"/>
          <docvar key="mnemonic" value="B"/>
        </docvars>
        <asmtemplate><text>B{</text><a hover="For the &quot;T2&quot; and &quot;T4&quot; variants: see x[Standard assembler syntax fields](Babbefhf)." link="AL_option__6">&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;T4&quot; variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32 to that offset." link="S_J1_J2_imm10_imm11">&lt;label&gt;</a></asmtemplate>
        <asmtemplate comment="&lt;label&gt; can be represented in T2"><text>B{</text><a hover="For the &quot;T2&quot; and &quot;T4&quot; variants: see x[Standard assembler syntax fields](Babbefhf)." link="AL_option__6">&lt;c&gt;</a><text>}.W  </text><a hover="For the &quot;T4&quot; variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the B instruction to this label, then selects an encoding that sets imm32 to that offset." link="S_J1_J2_imm10_imm11">&lt;label&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="T32.w.bcrtrl.b.B_T4" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let I1 : bit = NOT(J1 XOR S);
let I2 : bit = NOT(J2 XOR S);
let imm32 : bits(32) = SignExtend{}(S::I1::I2::imm10::imm11::'0');
if InITBlock() &amp;&amp; !LastInITBlock() then UnpredictableProcedure(); end;</pstext></ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="B_A1" symboldefcount="1">
      <symbol link="cond__3">&lt;c&gt;</symbol>
      <account encodedin="cond">
        <intro>
          <para>For the "A1" variant: see <xref linkend="Babbefhf">Standard assembler syntax fields</xref>.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="B_T1, B_T3, T3B_B_T3" symboldefcount="2">
      <symbol link="cond__6">&lt;c&gt;</symbol>
      <account encodedin="cond">
        <intro>
          <para>For the "T1" and "T3" variants: see <xref linkend="Babbefhf">Standard assembler syntax fields</xref>. Must not be <value>AL</value> or omitted.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="B_T2, B_T4, T4B_B_T4" symboldefcount="3">
      <symbol link="AL_option__6">&lt;c&gt;</symbol>
      <account encodedin="">
        <intro>
          <para>For the "T2" and "T4" variants: see <xref linkend="Babbefhf">Standard assembler syntax fields</xref>.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="B_A1, B_T1, B_T2, T3B_B_T3, B_T4" 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="B_A1" symboldefcount="1">
      <symbol link="label__2">&lt;label&gt;</symbol>
      <account encodedin="imm24">
        <intro>
          <para>For the "A1" variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the <instruction>B</instruction> instruction to this label, then selects an encoding that sets <field>imm32</field> to that offset.</para>
          <para>Permitted offsets are multiples of 4 in the range –33554432 to 33554428.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="B_T1" symboldefcount="2">
      <symbol link="label__4">&lt;label&gt;</symbol>
      <account encodedin="imm8">
        <intro>
          <para>For the "T1" variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the <instruction>B</instruction> instruction to this label, then selects an encoding that sets <field>imm32</field> to that offset. Permitted offsets are even numbers in the range –256 to 254.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="B_T2" symboldefcount="3">
      <symbol link="label__5">&lt;label&gt;</symbol>
      <account encodedin="imm11">
        <intro>
          <para>For the "T2" variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the <instruction>B</instruction> instruction to this label, then selects an encoding that sets <field>imm32</field> to that offset. Permitted offsets are even numbers in the range –2048 to 2046.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="B_T3, T3B_B_T3" symboldefcount="4">
      <symbol link="S_J2_J1_imm6_imm11">&lt;label&gt;</symbol>
      <account encodedin="(S :: J2 :: J1 :: imm6 :: imm11)">
        <intro>
          <para>For the "T3" variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the <instruction>B</instruction> instruction to this label, then selects an encoding that sets <field>imm32</field> to that offset.</para>
          <para>Permitted offsets are even numbers in the range –1048576 to 1048574.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="B_T4, T4B_B_T4" symboldefcount="5">
      <symbol link="S_J1_J2_imm10_imm11">&lt;label&gt;</symbol>
      <account encodedin="(S :: NOT (J1 XOR S) :: NOT (J2 XOR S) :: imm10 :: imm11)">
        <intro>
          <para>For the "T4" variant: the label of the instruction that is to be branched to. The assembler calculates the required value of the offset from the PC value of the <instruction>B</instruction> instruction to this label, then selects an encoding that sets <field>imm32</field> to that offset.</para>
          <para>Permitted offsets are even numbers in the range –16777216 to 16777214.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A32.brblk.b_imm.B_A1" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">if ConditionPassed() then
    EncodingSpecificOperations();
    BranchWritePC(PC32() + imm32, BranchType_DIR);
end;</pstext></ps>
  </ps_section>
  <timestamp>2026-03-12 12:23:09</timestamp>
  <commit_id>2025-09_rel_asl1</commit_id>
</instructionsection>
