Files
archived-ballistic/spec/arm64_xml/ext_z_zi.xml
Ronald Caesar 26a677f8b4 decoder: Add ARM specification docs
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-12-12 18:11:36 -04:00

226 lines
12 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<?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-2022 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="ext_z_zi" title="EXT" type="instruction">
<docvars>
<docvar key="instr-class" value="sve" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="EXT" />
</docvars>
<heading>EXT</heading>
<desc>
<brief>Extract vector from pair of vectors</brief>
<description>
<para>Copy the indexed byte up to the last byte of the first source vector to the bottom of the result vector, then fill the remainder of the result starting from the first byte of the second source vector. The result is placed destructively in the destination and first source vector, or constructively in the destination vector. This instruction is unpredicated.</para>
<para>An index that is greater than or equal to the vector length in bytes is treated as zero, resulting in the first source vector being copied to the result unchanged.</para>
<para>The Destructive encoding of this instruction might be immediately preceded in program order by a MOVPRFX instruction. The MOVPRFX instruction must conform to all of the following requirements, otherwise the behavior of the MOVPRFX and this instruction is UNPREDICTABLE: The MOVPRFX instruction must be unpredicated. The MOVPRFX instruction must specify the same destination register as this instruction. The destination register must not refer to architectural register state referenced by any other source operand register of this instruction.</para>
</description>
<status>Green</status>
<predicated>False</predicated>
<uses_dit condition="FEAT_SVE2 is implemented or FEAT_SME is implemented">True</uses_dit>
<takes_movprfx>False</takes_movprfx>
</desc>
<alias_list howmany="0"></alias_list>
<classes>
<classesintro count="2">
<txt>It has encodings from 2 classes:</txt>
<a href="#iclass_sve_const">Constructive</a>
<txt> and </txt>
<a href="#iclass_sve_dest">Destructive</a>
</classesintro>
<iclass name="Constructive" oneof="2" id="iclass_sve_const" no_encodings="1" isa="A64">
<docvars>
<docvar key="instr-class" value="sve" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="EXT" />
<docvar key="sve-dest_const" value="sve-const" />
</docvars>
<iclassintro count="1"></iclassintro>
<regdiagram form="32" psname="EXT-Z.ZI-Con">
<box hibit="31" width="11" settings="11">
<c>0</c>
<c>0</c>
<c>0</c>
<c>0</c>
<c>0</c>
<c>1</c>
<c>0</c>
<c>1</c>
<c>0</c>
<c>1</c>
<c>1</c>
</box>
<box hibit="20" width="5" name="imm8h" usename="1">
<c colspan="5"></c>
</box>
<box hibit="15" width="3" settings="3">
<c>0</c>
<c>0</c>
<c>0</c>
</box>
<box hibit="12" width="3" name="imm8l" usename="1">
<c colspan="3"></c>
</box>
<box hibit="9" width="5" name="Zn" usename="1">
<c colspan="5"></c>
</box>
<box hibit="4" width="5" name="Zd" usename="1">
<c colspan="5"></c>
</box>
</regdiagram>
<encoding name="ext_z_zi_con" oneofinclass="1" oneof="2" label="">
<docvars>
<docvar key="instr-class" value="sve" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="EXT" />
<docvar key="sve-dest_const" value="sve-const" />
</docvars>
<asmtemplate><text>EXT </text><a link="sa_zd" hover="Destination scalable vector register (field &quot;Zd&quot;)">&lt;Zd&gt;</a><text>.B, </text><text>{</text><text> </text><a link="sa_zn1" hover="First scalable vector register of a multi-vector sequence (field &quot;Zn&quot;)">&lt;Zn1&gt;</a><text>.B, </text><a link="sa_zn2" hover="Second scalable vector register of a multi-vector sequence (field &quot;Zn&quot;)">&lt;Zn2&gt;</a><text>.B </text><text>}</text><text>, #</text><a link="sa_imm" hover="Unsigned immediate operand [0-255] (field &quot;imm8h:imm8l&quot;)">&lt;imm&gt;</a></asmtemplate>
</encoding>
<ps_section howmany="1">
<ps name="EXT-Z.ZI-Con" mylink="EXT-Z.ZI-Con" enclabels="" sections="1" secttype="noheading">
<pstext mayhavelinks="1" section="Decode" rep_section="decode">if !<a link="impl-aarch64.HaveSVE2.0" file="shared_pseudocode.xml" hover="function: boolean HaveSVE2()">HaveSVE2</a>() &amp;&amp; !<a link="impl-aarch64.HaveSME.0" file="shared_pseudocode.xml" hover="function: boolean HaveSME()">HaveSME</a>() then UNDEFINED;
constant integer esize = 8;
integer dst = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Zd);
integer s1 = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Zn);
integer s2 = (s1 + 1) MOD 32;
integer position = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(imm8h:imm8l);</pstext>
</ps>
</ps_section>
</iclass>
<iclass name="Destructive" oneof="2" id="iclass_sve_dest" no_encodings="1" isa="A64">
<docvars>
<docvar key="instr-class" value="sve" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="EXT" />
<docvar key="sve-dest_const" value="sve-dest" />
</docvars>
<iclassintro count="1"></iclassintro>
<regdiagram form="32" psname="EXT-Z.ZI-Des">
<box hibit="31" width="11" settings="11">
<c>0</c>
<c>0</c>
<c>0</c>
<c>0</c>
<c>0</c>
<c>1</c>
<c>0</c>
<c>1</c>
<c>0</c>
<c>0</c>
<c>1</c>
</box>
<box hibit="20" width="5" name="imm8h" usename="1">
<c colspan="5"></c>
</box>
<box hibit="15" width="3" settings="3">
<c>0</c>
<c>0</c>
<c>0</c>
</box>
<box hibit="12" width="3" name="imm8l" usename="1">
<c colspan="3"></c>
</box>
<box hibit="9" width="5" name="Zm" usename="1">
<c colspan="5"></c>
</box>
<box hibit="4" width="5" name="Zdn" usename="1">
<c colspan="5"></c>
</box>
</regdiagram>
<encoding name="ext_z_zi_des" oneofinclass="1" oneof="2" label="">
<docvars>
<docvar key="instr-class" value="sve" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="EXT" />
<docvar key="sve-dest_const" value="sve-dest" />
</docvars>
<asmtemplate><text>EXT </text><a link="sa_zdn" hover="First source and destination scalable vector register (field &quot;Zdn&quot;)">&lt;Zdn&gt;</a><text>.B, </text><a link="sa_zdn" hover="First source and destination scalable vector register (field &quot;Zdn&quot;)">&lt;Zdn&gt;</a><text>.B, </text><a link="sa_zm" hover="Second source scalable vector register (field &quot;Zm&quot;)">&lt;Zm&gt;</a><text>.B, #</text><a link="sa_imm" hover="Unsigned immediate operand [0-255] (field &quot;imm8h:imm8l&quot;)">&lt;imm&gt;</a></asmtemplate>
</encoding>
<ps_section howmany="1">
<ps name="EXT-Z.ZI-Des" mylink="EXT-Z.ZI-Des" enclabels="" sections="1" secttype="noheading">
<pstext mayhavelinks="1" section="Decode" rep_section="decode">if !<a link="impl-aarch64.HaveSVE.0" file="shared_pseudocode.xml" hover="function: boolean HaveSVE()">HaveSVE</a>() &amp;&amp; !<a link="impl-aarch64.HaveSME.0" file="shared_pseudocode.xml" hover="function: boolean HaveSME()">HaveSME</a>() then UNDEFINED;
constant integer esize = 8;
integer dst = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Zdn);
integer s1 = dst;
integer s2 = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Zm);
integer position = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(imm8h:imm8l);</pstext>
</ps>
</ps_section>
</iclass>
</classes>
<explanations scope="all">
<explanation enclist="ext_z_zi_con" symboldefcount="1">
<symbol link="sa_zd">&lt;Zd&gt;</symbol>
<account encodedin="Zd">
<intro>
<para>Is the name of the destination scalable vector register, encoded in the "Zd" field.</para>
</intro>
</account>
</explanation>
<explanation enclist="ext_z_zi_con" symboldefcount="1">
<symbol link="sa_zn1">&lt;Zn1&gt;</symbol>
<account encodedin="Zn">
<intro>
<para>Is the name of the first scalable vector register of a multi-vector sequence, encoded in the "Zn" field.</para>
</intro>
</account>
</explanation>
<explanation enclist="ext_z_zi_con" symboldefcount="1">
<symbol link="sa_zn2">&lt;Zn2&gt;</symbol>
<account encodedin="Zn">
<intro>
<para>Is the name of the second scalable vector register of a multi-vector sequence, encoded in the "Zn" field.</para>
</intro>
</account>
</explanation>
<explanation enclist="ext_z_zi_des" symboldefcount="1">
<symbol link="sa_zdn">&lt;Zdn&gt;</symbol>
<account encodedin="Zdn">
<intro>
<para>Is the name of the first source and destination scalable vector register, encoded in the "Zdn" field.</para>
</intro>
</account>
</explanation>
<explanation enclist="ext_z_zi_des" symboldefcount="1">
<symbol link="sa_zm">&lt;Zm&gt;</symbol>
<account encodedin="Zm">
<intro>
<para>Is the name of the second source scalable vector register, encoded in the "Zm" field.</para>
</intro>
</account>
</explanation>
<explanation enclist="ext_z_zi_con, ext_z_zi_des" symboldefcount="1">
<symbol link="sa_imm">&lt;imm&gt;</symbol>
<account encodedin="imm8h:imm8l">
<intro>
<para>Is the unsigned immediate operand, in the range 0 to 255, encoded in the "imm8h:imm8l" fields.</para>
</intro>
</account>
</explanation>
</explanations>
<ps_section howmany="1">
<ps name="EXT-Z.ZI-Con" mylink="execute" enclabels="" sections="1" secttype="Operation">
<pstext mayhavelinks="1" section="Execute" rep_section="execute"><a link="impl-aarch64.CheckSVEEnabled.0" file="shared_pseudocode.xml" hover="function: CheckSVEEnabled()">CheckSVEEnabled</a>();
constant integer VL = <a link="impl-aarch64.CurrentVL.read.none" file="shared_pseudocode.xml" hover="accessor: integer CurrentVL">CurrentVL</a>;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(VL) operand1 = <a link="impl-aarch64.Z.read.2" file="shared_pseudocode.xml" hover="accessor: bits(width) Z[integer n, integer width]">Z</a>[s1, VL];
bits(VL) operand2 = <a link="impl-aarch64.Z.read.2" file="shared_pseudocode.xml" hover="accessor: bits(width) Z[integer n, integer width]">Z</a>[s2, VL];
bits(VL) result;
if position &gt;= elements then
position = 0;
position = position &lt;&lt; 3;
bits(VL*2) concat = operand2 : operand1;
result = concat&lt;(position+VL)-1:position&gt;;
<a link="impl-aarch64.Z.write.2" file="shared_pseudocode.xml" hover="accessor: Z[integer n, integer width] = bits(width) value">Z</a>[dst, VL] = result;</pstext>
</ps>
</ps_section>
</instructionsection>