<?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="uqinch_z_zs" title="UQINCH (vector)" type="instruction">
  <docvars>
    <docvar key="instr-class" value="sve" />
    <docvar key="isa" value="A64" />
    <docvar key="mnemonic" value="UQINCH" />
    <docvar key="sve-esize" value="esize-halfword" />
  </docvars>
  <heading>UQINCH (vector)</heading>
  <desc>
    <brief>Unsigned saturating increment vector by multiple of 16-bit predicate constraint element count</brief>
    <description>
      <para>Determines the number of active 16-bit elements implied by the named predicate constraint, multiplies that by an immediate in the range 1 to 16 inclusive, and then uses the result to increment all destination vector elements. The results are saturated to the 16-bit unsigned integer range.</para>
      <para>The named predicate constraint limits the number of active elements in a single predicate to:</para>
      <list type="unordered">
        <listitem>
          <content>A fixed number (<value>VL1</value> to <value>VL256</value>)</content>
        </listitem>
        <listitem>
          <content>The largest power of two (<value>POW2</value>)</content>
        </listitem>
        <listitem>
          <content>The largest multiple of three or four (<value>MUL3</value> or <value>MUL4</value>)</content>
        </listitem>
        <listitem>
          <content>All available, implicitly a multiple of two (<value>ALL</value>).</content>
        </listitem>
      </list>
      <para>Unspecified or out of range constraint encodings generate an empty predicate or zero element count rather than Undefined Instruction exception.</para>
    </description>
    <status>Green</status>
    <predicated>False</predicated>
    <takes_movprfx>True</takes_movprfx>
  </desc>
  <alias_list howmany="0"></alias_list>
  <classes>
    <iclass name="SVE" oneof="1" id="iclass_sve" no_encodings="1" isa="A64">
      <docvars>
        <docvar key="instr-class" value="sve" />
        <docvar key="isa" value="A64" />
        <docvar key="mnemonic" value="UQINCH" />
        <docvar key="sve-esize" value="esize-halfword" />
      </docvars>
      <iclassintro count="1"></iclassintro>
      <regdiagram form="32" psname="UQINCH-Z.ZS-_" tworows="1">
        <box hibit="31" width="8" settings="8">
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>0</c>
          <c>1</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="23" name="size&lt;1&gt;" usename="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="22" name="size&lt;0&gt;" usename="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="21" width="2" settings="2">
          <c>1</c>
          <c>0</c>
        </box>
        <box hibit="19" width="4" name="imm4" usename="1">
          <c colspan="4"></c>
        </box>
        <box hibit="15" width="4" settings="4">
          <c>1</c>
          <c>1</c>
          <c>0</c>
          <c>0</c>
        </box>
        <box hibit="11" name="D" usename="1" settings="1">
          <c>0</c>
        </box>
        <box hibit="10" name="U" usename="1" settings="1">
          <c>1</c>
        </box>
        <box hibit="9" width="5" name="pattern" usename="1">
          <c colspan="5"></c>
        </box>
        <box hibit="4" width="5" name="Zdn" usename="1">
          <c colspan="5"></c>
        </box>
      </regdiagram>
      <encoding name="uqinch_z_zs_" oneofinclass="1" oneof="1" label="">
        <docvars>
          <docvar key="instr-class" value="sve" />
          <docvar key="isa" value="A64" />
          <docvar key="mnemonic" value="UQINCH" />
          <docvar key="sve-esize" value="esize-halfword" />
        </docvars>
        <asmtemplate><text>UQINCH  </text><a link="sa_zdn" hover="Source and destination scalable vector register (field &quot;Zdn&quot;)">&lt;Zdn&gt;</a><text>.H</text><text>{</text><text>, </text><a link="sa_pattern" hover="Optional pattern specifier, default ALL (field &quot;pattern&quot;) [#uimm5,ALL,MUL3,MUL4,POW2,VL1,VL2,VL3,VL4,VL5,VL6,VL7,VL8,VL16,VL32,VL64,VL128,VL256]">&lt;pattern&gt;</a><text>{</text><text>, MUL #</text><a link="sa_imm" hover="Immediate multiplier [1-16], default 1 (field &quot;imm4&quot;)">&lt;imm&gt;</a><text>}</text><text>}</text></asmtemplate>
      </encoding>
      <ps_section howmany="1">
        <ps name="UQINCH-Z.ZS-_" mylink="UQINCH-Z.ZS-_" 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 = 16;
integer dn = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(Zdn);
bits(5) pat = pattern;
integer imm = <a link="impl-shared.UInt.1" file="shared_pseudocode.xml" hover="function: integer UInt(bits(N) x)">UInt</a>(imm4) + 1;
boolean unsigned = TRUE;</pstext>
        </ps>
      </ps_section>
    </iclass>
  </classes>
  <explanations scope="all">
    <explanation enclist="uqinch_z_zs_" symboldefcount="1">
      <symbol link="sa_zdn">&lt;Zdn&gt;</symbol>
      <account encodedin="Zdn">
        <intro>
          <para>Is the name of the source and destination scalable vector register, encoded in the "Zdn" field.</para>
        </intro>
      </account>
    </explanation>
    <explanation enclist="uqinch_z_zs_" symboldefcount="1">
      <symbol link="sa_pattern">&lt;pattern&gt;</symbol>
      <definition encodedin="pattern">
        <intro>Is the optional pattern specifier, defaulting to ALL, </intro>
        <table class="valuetable">
          <tgroup cols="2">
            <thead>
              <row>
                <entry class="bitfield">pattern</entry>
                <entry class="symbol">&lt;pattern&gt;</entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry class="bitfield">00000</entry>
                <entry class="symbol">POW2</entry>
              </row>
              <row>
                <entry class="bitfield">00001</entry>
                <entry class="symbol">VL1</entry>
              </row>
              <row>
                <entry class="bitfield">00010</entry>
                <entry class="symbol">VL2</entry>
              </row>
              <row>
                <entry class="bitfield">00011</entry>
                <entry class="symbol">VL3</entry>
              </row>
              <row>
                <entry class="bitfield">00100</entry>
                <entry class="symbol">VL4</entry>
              </row>
              <row>
                <entry class="bitfield">00101</entry>
                <entry class="symbol">VL5</entry>
              </row>
              <row>
                <entry class="bitfield">00110</entry>
                <entry class="symbol">VL6</entry>
              </row>
              <row>
                <entry class="bitfield">00111</entry>
                <entry class="symbol">VL7</entry>
              </row>
              <row>
                <entry class="bitfield">01000</entry>
                <entry class="symbol">VL8</entry>
              </row>
              <row>
                <entry class="bitfield">01001</entry>
                <entry class="symbol">VL16</entry>
              </row>
              <row>
                <entry class="bitfield">01010</entry>
                <entry class="symbol">VL32</entry>
              </row>
              <row>
                <entry class="bitfield">01011</entry>
                <entry class="symbol">VL64</entry>
              </row>
              <row>
                <entry class="bitfield">01100</entry>
                <entry class="symbol">VL128</entry>
              </row>
              <row>
                <entry class="bitfield">01101</entry>
                <entry class="symbol">VL256</entry>
              </row>
              <row>
                <entry class="bitfield">0111x</entry>
                <entry class="symbol">#uimm5</entry>
              </row>
              <row>
                <entry class="bitfield">101x1</entry>
                <entry class="symbol">#uimm5</entry>
              </row>
              <row>
                <entry class="bitfield">10110</entry>
                <entry class="symbol">#uimm5</entry>
              </row>
              <row>
                <entry class="bitfield">1x0x1</entry>
                <entry class="symbol">#uimm5</entry>
              </row>
              <row>
                <entry class="bitfield">1x010</entry>
                <entry class="symbol">#uimm5</entry>
              </row>
              <row>
                <entry class="bitfield">1xx00</entry>
                <entry class="symbol">#uimm5</entry>
              </row>
              <row>
                <entry class="bitfield">11101</entry>
                <entry class="symbol">MUL4</entry>
              </row>
              <row>
                <entry class="bitfield">11110</entry>
                <entry class="symbol">MUL3</entry>
              </row>
              <row>
                <entry class="bitfield">11111</entry>
                <entry class="symbol">ALL</entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </definition>
    </explanation>
    <explanation enclist="uqinch_z_zs_" symboldefcount="1">
      <symbol link="sa_imm">&lt;imm&gt;</symbol>
      <account encodedin="imm4">
        <intro>
          <para>Is the immediate multiplier, in the range 1 to 16, defaulting to 1, encoded in the "imm4" field.</para>
        </intro>
      </account>
    </explanation>
  </explanations>
  <ps_section howmany="1">
    <ps name="UQINCH-Z.ZS-_" 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 elements = VL DIV esize;
integer count = <a link="impl-aarch64.DecodePredCount.2" file="shared_pseudocode.xml" hover="function: integer DecodePredCount(bits(5) pattern, integer esize)">DecodePredCount</a>(pat, 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>[dn, VL];
bits(VL) result;

for e = 0 to elements-1
    integer element1 = <a link="impl-shared.Int.2" file="shared_pseudocode.xml" hover="function: integer Int(bits(N) x, boolean unsigned)">Int</a>(<a link="impl-shared.Elem.read.3" file="shared_pseudocode.xml" hover="accessor: bits(size) Elem[bits(N) vector, integer e, integer size]">Elem</a>[operand1, e, esize], unsigned);
    (<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, esize], -) = <a link="impl-shared.SatQ.3" file="shared_pseudocode.xml" hover="function: (bits(N), boolean) SatQ(integer i, integer N, boolean unsigned)">SatQ</a>(element1 + (count * imm), esize, unsigned);

<a link="impl-aarch64.Z.write.2" file="shared_pseudocode.xml" hover="accessor: Z[integer n, integer width] = bits(width) value">Z</a>[dn, VL] = result;</pstext>
    </ps>
  </ps_section>
</instructionsection>
