Files
archived-ballistic/spec/arm64_xml/whilegt_p_p_rr.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

219 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="whilegt_p_p_rr" title="WHILEGT (predicate)" type="instruction">
<docvars>
<docvar key="instr-class" value="sve2" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="WHILEGT" />
<docvar key="sve-elem-type" value="8-64-elem" />
</docvars>
<heading>WHILEGT (predicate)</heading>
<desc>
<brief>While decrementing signed scalar greater than scalar</brief>
<description>
<para>Generate a predicate that starting from the highest numbered element is true while the decrementing value of the first, signed scalar operand is greater than the second scalar operand and false thereafter down to the lowest numbered element.</para>
<para />
<para>The full width of the scalar operands is significant for the purposes of comparison, and the full width first operand is decremented by one for each destination predicate element, irrespective of the predicate result element size. The first general-purpose source register is not itself updated.</para>
<para>The predicate result is placed in the predicate destination register. Sets the <arm-defined-word>First</arm-defined-word> (N), <arm-defined-word>None</arm-defined-word> (Z), <arm-defined-word>!Last</arm-defined-word> (C) condition flags based on the predicate result, and the V flag to zero.</para>
</description>
<status>Green</status>
<predicated>False</predicated>
<uses_dit condition="FEAT_SVE2 is implemented or FEAT_SME is implemented">True</uses_dit>
</desc>
<alias_list howmany="0"></alias_list>
<classes>
<iclass name="SVE2" oneof="1" id="iclass_sve2" no_encodings="1" isa="A64">
<docvars>
<docvar key="instr-class" value="sve2" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="WHILEGT" />
<docvar key="sve-elem-type" value="8-64-elem" />
</docvars>
<iclassintro count="1"></iclassintro>
<regdiagram form="32" psname="WHILEGT-P.P.RR-_" tworows="1">
<box hibit="31" width="8" settings="8">
<c>0</c>
<c>0</c>
<c>1</c>
<c>0</c>
<c>0</c>
<c>1</c>
<c>0</c>
<c>1</c>
</box>
<box hibit="23" width="2" name="size" usename="1">
<c colspan="2"></c>
</box>
<box hibit="21" settings="1">
<c>1</c>
</box>
<box hibit="20" width="5" name="Rm" 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" name="sf" usename="1">
<c></c>
</box>
<box hibit="11" name="U" usename="1" settings="1">
<c>0</c>
</box>
<box hibit="10" name="lt" usename="1" settings="1">
<c>0</c>
</box>
<box hibit="9" width="5" name="Rn" usename="1">
<c colspan="5"></c>
</box>
<box hibit="4" name="eq" usename="1" settings="1">
<c>1</c>
</box>
<box hibit="3" width="4" name="Pd" usename="1">
<c colspan="4"></c>
</box>
</regdiagram>
<encoding name="whilegt_p_p_rr_" oneofinclass="1" oneof="1" label="">
<docvars>
<docvar key="instr-class" value="sve2" />
<docvar key="isa" value="A64" />
<docvar key="mnemonic" value="WHILEGT" />
<docvar key="sve-elem-type" value="8-64-elem" />
</docvars>
<asmtemplate><text>WHILEGT </text><a link="sa_pd" hover="Destination scalable predicate register (field &quot;Pd&quot;)">&lt;Pd&gt;</a><text>.</text><a link="sa_t" hover="Size specifier (field &quot;size&quot;) [B,D,H,S]">&lt;T&gt;</a><text>, </text><a link="sa_r" hover="Width specifier (field &quot;sf&quot;) [W,X]">&lt;R&gt;</a><a link="sa_n" hover="Source general-purpose register number [0-30] or ZR (31) (field &quot;Rn&quot;)">&lt;n&gt;</a><text>, </text><a link="sa_r" hover="Width specifier (field &quot;sf&quot;) [W,X]">&lt;R&gt;</a><a link="sa_m" hover="Source general-purpose register number [0-30] or ZR (31) (field &quot;Rm&quot;)">&lt;m&gt;</a></asmtemplate>
</encoding>
<ps_section howmany="1">
<ps name="WHILEGT-P.P.RR-_" mylink="WHILEGT-P.P.RR-_" 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 &lt;&lt; <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(size);
constant integer rsize = 32 &lt;&lt; <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(sf);
integer n = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Rn);
integer m = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Rm);
integer d = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Pd);
boolean unsigned = FALSE;
<a link="SVECmp" file="shared_pseudocode.xml" hover="enumeration SVECmp { Cmp_EQ, Cmp_NE, Cmp_GE, Cmp_GT, Cmp_LT, Cmp_LE, Cmp_UN }">SVECmp</a> op = <a link="Cmp_GT" file="shared_pseudocode.xml" hover="enumeration SVECmp { Cmp_EQ, Cmp_NE, Cmp_GE, Cmp_GT, Cmp_LT, Cmp_LE, Cmp_UN }">Cmp_GT</a>;</pstext>
</ps>
</ps_section>
</iclass>
</classes>
<explanations scope="all">
<explanation enclist="whilegt_p_p_rr_" symboldefcount="1">
<symbol link="sa_pd">&lt;Pd&gt;</symbol>
<account encodedin="Pd">
<intro>
<para>Is the name of the destination scalable predicate register, encoded in the "Pd" field.</para>
</intro>
</account>
</explanation>
<explanation enclist="whilegt_p_p_rr_" symboldefcount="1">
<symbol link="sa_t">&lt;T&gt;</symbol>
<definition encodedin="size">
<intro>Is the size specifier, </intro>
<table class="valuetable">
<tgroup cols="2">
<thead>
<row>
<entry class="bitfield">size</entry>
<entry class="symbol">&lt;T&gt;</entry>
</row>
</thead>
<tbody>
<row>
<entry class="bitfield">00</entry>
<entry class="symbol">B</entry>
</row>
<row>
<entry class="bitfield">01</entry>
<entry class="symbol">H</entry>
</row>
<row>
<entry class="bitfield">10</entry>
<entry class="symbol">S</entry>
</row>
<row>
<entry class="bitfield">11</entry>
<entry class="symbol">D</entry>
</row>
</tbody>
</tgroup>
</table>
</definition>
</explanation>
<explanation enclist="whilegt_p_p_rr_" symboldefcount="1">
<symbol link="sa_r">&lt;R&gt;</symbol>
<definition encodedin="sf">
<intro>Is a width specifier, </intro>
<table class="valuetable">
<tgroup cols="2">
<thead>
<row>
<entry class="bitfield">sf</entry>
<entry class="symbol">&lt;R&gt;</entry>
</row>
</thead>
<tbody>
<row>
<entry class="bitfield">0</entry>
<entry class="symbol">W</entry>
</row>
<row>
<entry class="bitfield">1</entry>
<entry class="symbol">X</entry>
</row>
</tbody>
</tgroup>
</table>
</definition>
</explanation>
<explanation enclist="whilegt_p_p_rr_" symboldefcount="1">
<symbol link="sa_n">&lt;n&gt;</symbol>
<account encodedin="Rn">
<intro>
<para>Is the number [0-30] of the source general-purpose register or the name ZR (31), encoded in the "Rn" field.</para>
</intro>
</account>
</explanation>
<explanation enclist="whilegt_p_p_rr_" symboldefcount="1">
<symbol link="sa_m">&lt;m&gt;</symbol>
<account encodedin="Rm">
<intro>
<para>Is the number [0-30] of the source general-purpose register or the name ZR (31), encoded in the "Rm" field.</para>
</intro>
</account>
</explanation>
</explanations>
<ps_section howmany="1">
<ps name="WHILEGT-P.P.RR-_" 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(PL) mask = <a link="impl-shared.Ones.1" file="shared_pseudocode.xml" hover="function: bits(N) Ones(integer N)">Ones</a>(PL);
bits(rsize) operand1 = <a link="impl-aarch64.X.read.2" file="shared_pseudocode.xml" hover="accessor: bits(width) X[integer n, integer width]">X</a>[n, rsize];
bits(rsize) operand2 = <a link="impl-aarch64.X.read.2" file="shared_pseudocode.xml" hover="accessor: bits(width) X[integer n, integer width]">X</a>[m, rsize];
bits(PL) result;
boolean last = TRUE;
constant integer psize = esize DIV 8;
for e = elements-1 downto 0
boolean cond;
case op of
when <a link="Cmp_GT" file="shared_pseudocode.xml" hover="enumeration SVECmp { Cmp_EQ, Cmp_NE, Cmp_GE, Cmp_GT, Cmp_LT, Cmp_LE, Cmp_UN }">Cmp_GT</a> cond = (<a link="impl-shared.Int.2" file="shared_pseudocode.xml" hover="function: integer Int(bits(N) x, boolean unsigned)">Int</a>(operand1, unsigned) &gt; <a link="impl-shared.Int.2" file="shared_pseudocode.xml" hover="function: integer Int(bits(N) x, boolean unsigned)">Int</a>(operand2, unsigned));
when <a link="Cmp_GE" file="shared_pseudocode.xml" hover="enumeration SVECmp { Cmp_EQ, Cmp_NE, Cmp_GE, Cmp_GT, Cmp_LT, Cmp_LE, Cmp_UN }">Cmp_GE</a> cond = (<a link="impl-shared.Int.2" file="shared_pseudocode.xml" hover="function: integer Int(bits(N) x, boolean unsigned)">Int</a>(operand1, unsigned) &gt;= <a link="impl-shared.Int.2" file="shared_pseudocode.xml" hover="function: integer Int(bits(N) x, boolean unsigned)">Int</a>(operand2, unsigned));
last = last &amp;&amp; cond;
bit pbit = if last then '1' else '0';
<a link="impl-shared.Elem.write.3" file="shared_pseudocode.xml" hover="accessor: Elem[bits(N) &amp;vector, integer e, integer size] = bits(size) value">Elem</a>[result, e, psize] = <a link="impl-shared.ZeroExtend.2" file="shared_pseudocode.xml" hover="function: bits(N) ZeroExtend(bits(M) x, integer N)">ZeroExtend</a>(pbit, psize);
operand1 = operand1 - 1;
PSTATE.&lt;N,Z,C,V&gt; = <a link="impl-aarch64.PredTest.3" file="shared_pseudocode.xml" hover="function: bits(4) PredTest(bits(N) mask, bits(N) result, integer esize)">PredTest</a>(mask, result, esize);
<a link="impl-aarch64.P.write.2" file="shared_pseudocode.xml" hover="accessor: P[integer n, integer width] = bits(width) value">P</a>[d, PL] = result;</pstext>
</ps>
</ps_section>
</instructionsection>