<?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="ADRP" title="ADRP -- A64" type="instruction">
  <docvars>
    <docvar key="address-form" value="literal"/>
    <docvar key="instr-class" value="general"/>
    <docvar key="isa" value="A64"/>
    <docvar key="mnemonic" value="ADRP"/>
    <docvar key="offset-type" value="off19s"/>
  </docvars>
  <heading>ADRP</heading>
  <desc>
    <brief>
      <para>Form PC-relative address to 4KB page</para>
    </brief>
    <authored>
      <para>This instruction adds an immediate value that is
shifted left by 12 bits, to the PC value to form a PC-relative address,
with the bottom 12 bits masked out, and writes the result to the
destination register.</para>
    </authored>
  </desc>
  <alias_list howmany="0"/>
  <classes>
    <iclass name="Literal" oneof="1" id="iclass_literal" no_encodings="1" isa="A64">
      <docvars>
        <docvar key="address-form" value="literal"/>
        <docvar key="instr-class" value="general"/>
        <docvar key="isa" value="A64"/>
        <docvar key="mnemonic" value="ADRP"/>
        <docvar key="offset-type" value="off19s"/>
      </docvars>
      <iclassintro count="1"/>
      <regdiagram form="32" psname="A64.dpimm.pcreladdr.ADRP_only_pcreladdr" tworows="1">
        <box hibit="31" name="op" usename="1" settings="1" psbits="x">
          <c>1</c>
        </box>
        <box hibit="30" width="2" name="immlo" usename="1">
          <c colspan="2"/>
        </box>
        <box hibit="28" width="3" settings="3">
          <c>1</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="25" width="2" settings="2">
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="23" width="19" name="immhi" usename="1">
          <c colspan="19"/>
        </box>
        <box hibit="4" width="5" name="Rd" usename="1">
          <c colspan="5"/>
        </box>
      </regdiagram>
      <encoding name="ADRP_only_pcreladdr" oneofinclass="1" oneof="1" label="">
        <docvars>
          <docvar key="address-form" value="literal"/>
          <docvar key="instr-class" value="general"/>
          <docvar key="isa" value="A64"/>
          <docvar key="offset-type" value="off19s"/>
          <docvar key="mnemonic" value="ADRP"/>
        </docvars>
        <asmtemplate><text>ADRP  </text><a hover="Is the 64-bit name of the general-purpose destination register, encoded in the &quot;Rd&quot; field." link="XdOrXZR__6">&lt;Xd&gt;</a><text>, </text><a hover="Is the program label whose 4KB page address is to be calculated. Its offset from the page address of this instruction, in the range +/-4GB, is encoded as &quot;immhi:immlo&quot; times 4096." link="immhiimmlo_offset__2">&lt;label&gt;</a></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="A64.dpimm.pcreladdr.ADRP_only_pcreladdr" sections="1" secttype="noheading">
          <pstext mayhavelinks="1" section="Decode" rep_section="decode">let d : integer{} = UInt(Rd);
let imm : bits(64) = SignExtend{}(immhi::immlo::Zeros{12});</pstext></ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="ADRP_only_pcreladdr" symboldefcount="1">
      <symbol link="XdOrXZR__6">&lt;Xd&gt;</symbol>
      <account encodedin="Rd">
        <intro>
          <para>Is the 64-bit name of the general-purpose destination register, encoded in the "Rd" field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="ADRP_only_pcreladdr" symboldefcount="1">
      <symbol link="immhiimmlo_offset__2">&lt;label&gt;</symbol>
      <account encodedin="(immhi :: immlo)">
        <intro>
          <para>Is the program label whose 4KB page address is to be calculated. Its offset from the page address of this instruction, in the range +/-4GB, is encoded as "immhi:immlo" times 4096.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="A64.dpimm.pcreladdr.ADRP_only_pcreladdr" sections="1" secttype="Operation">
      <pstext mayhavelinks="1" section="Execute" rep_section="execute">let base : bits(64) = PC64()[63:12]::Zeros{12};
X{64}(d) = base + imm;</pstext></ps>
  </ps_section>
  <timestamp>2026-03-12 12:23:09</timestamp>
  <commit_id>2025-09_rel_asl1</commit_id>
</instructionsection>
