Added documentation for vset and vselect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26264 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Robert Bocchino 2006-02-17 21:18:08 +00:00
parent fb7217bea3
commit 7b81c758ab

View File

@ -29,7 +29,7 @@
</li>
<li><a href="#typesystem">Type System</a>
<ol>
<li><a href="#t_primitive">Primitive Types</a>
<li><a href="#t_primitive">Primitive Types</a>
<ol>
<li><a href="#t_classifications">Type Classifications</a></li>
</ol>
@ -96,9 +96,9 @@
<li><a href="#i_malloc">'<tt>malloc</tt>' Instruction</a></li>
<li><a href="#i_free">'<tt>free</tt>' Instruction</a></li>
<li><a href="#i_alloca">'<tt>alloca</tt>' Instruction</a></li>
<li><a href="#i_load">'<tt>load</tt>' Instruction</a></li>
<li><a href="#i_store">'<tt>store</tt>' Instruction</a></li>
<li><a href="#i_getelementptr">'<tt>getelementptr</tt>' Instruction</a></li>
<li><a href="#i_load">'<tt>load</tt>' Instruction</a></li>
<li><a href="#i_store">'<tt>store</tt>' Instruction</a></li>
<li><a href="#i_getelementptr">'<tt>getelementptr</tt>' Instruction</a></li>
</ol>
</li>
<li><a href="#otherops">Other Operations</a>
@ -106,6 +106,8 @@
<li><a href="#i_phi">'<tt>phi</tt>' Instruction</a></li>
<li><a href="#i_cast">'<tt>cast .. to</tt>' Instruction</a></li>
<li><a href="#i_select">'<tt>select</tt>' Instruction</a></li>
<li><a href="#i_vset">'<tt>vset</tt>' Instruction</a></li>
<li><a href="#i_vselect">'<tt>vselect</tt>' Instruction</a></li>
<li><a href="#i_extractelement">'<tt>extractelement</tt>' Instruction</a></li>
<li><a href="#i_insertelement">'<tt>insertelement</tt>' Instruction</a></li>
<li><a href="#i_call">'<tt>call</tt>' Instruction</a></li>
@ -1619,6 +1621,7 @@ Math Forum</a>.</p>
<h5>Example:</h5>
<pre> &lt;result&gt; = rem int 4, %var <i>; yields {int}:result = 4 % %var</i>
</pre>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="i_setcc">'<tt>set<i>cc</i></tt>'
@ -1664,6 +1667,7 @@ operand.</p>
&lt;result&gt; = setge sbyte 4, 5 <i>; yields {bool}:result = false</i>
</pre>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"> <a name="bitwiseops">Bitwise Binary
Operations</a> </div>
@ -2333,6 +2337,156 @@ value argument; otherwise, it returns the second value argument.
</pre>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="i_vset">'<tt>vset</tt>'
Instruction</a> </div>
<div class="doc_text">
<h5>Syntax:</h5>
<pre>&lt;result&gt; = vset &lt;op&gt;, &lt;n x &lt;ty&gt;&gt; &lt;var1&gt;, &lt;var2&gt; <i>; yields &lt;n x bool&gt;</i>
</pre>
<h5>Overview:</h5>
<p>The '<tt>vset</tt>' instruction returns a vector of boolean
values representing, at each position, the result of the comparison
between the values at that position in the two operands.</p>
<h5>Arguments:</h5>
<p>The arguments to a '<tt>vset</tt>' instruction are a comparison
operation and two value arguments. The value arguments must be of <a
href="#t_packed">packed</a> type, and they must have identical types.
For value arguments of integral element type, the operation argument
must be one of <tt>eq</tt>, <tt>ne</tt>, <tt>lt</tt>, <tt>gt</tt>,
<tt>le</tt>, <tt>ge</tt>, <tt>ult</tt>, <tt>ugt</tt>, <tt>ule</tt>,
<tt>uge</tt>, <tt>true</tt>, and <tt>false</tt>. For value arguments
of floating point element type, the operation argument must be one of
<tt>eq</tt>, <tt>ne</tt>, <tt>lt</tt>, <tt>gt</tt>, <tt>le</tt>,
<tt>ge</tt>, <tt>oeq</tt>, <tt>one</tt>, <tt>olt</tt>, <tt>ogt</tt>,
<tt>ole</tt>, <tt>oge</tt>, <tt>ueq</tt>, <tt>une</tt>, <tt>ult</tt>,
<tt>ugt</tt>, <tt>ule</tt>, <tt>uge</tt>, <tt>o</tt>, <tt>u</tt>,
<tt>true</tt>, and <tt>false</tt>. The result is a packed
<tt>bool</tt> value with the same length as each operand.</p>
<h5>Semantics:</h5>
<p>The following table shows the semantics of '<tt>vset</tt>' for
integral value arguments. For each position of the result, the
comparison is done on the corresponding positions of the two value
arguments. Note that the signedness of the comparison depends on the
comparison opcode and <i>not</i> on the signedness of the value
operands. E.g., <tt>vset lt <4 x unsigned> %x, %y</tt> does an
elementwise <i>signed</i> comparison of <tt>%x</tt> and
<tt>%y</tt>.</p>
<table border="1" cellspacing="0" cellpadding="4">
<tbody>
<tr><th>Operation</th><th>Result is true iff</th><th>Comparison is</th></tr>
<tr><td><tt>eq</tt></td><td>var1 == var2</td><td>--</td></tr>
<tr><td><tt>ne</tt></td><td>var1 != var2</td><td>--</td></tr>
<tr><td><tt>lt</tt></td><td>var1 &lt; var2</td><td>signed</td></tr>
<tr><td><tt>gt</tt></td><td>var1 &gt; var2</td><td>signed</td></tr>
<tr><td><tt>le</tt></td><td>var1 &lt;= var2</td><td>signed</td></tr>
<tr><td><tt>ge</tt></td><td>var1 &gt;= var2</td><td>signed</td></tr>
<tr><td><tt>ult</tt></td><td>var1 &lt; var2</td><td>unsigned</td></tr>
<tr><td><tt>ugt</tt></td><td>var1 &gt; var2</td><td>unsigned</td></tr>
<tr><td><tt>ule</tt></td><td>var1 &lt;= var2</td><td>unsigned</td></tr>
<tr><td><tt>uge</tt></td><td>var1 &gt;= var2</td><td>unsigned</td></tr>
<tr><td><tt>true</tt></td><td>always</td><td>--</td></tr>
<tr><td><tt>false</tt></td><td>never</td><td>--</td></tr>
</tbody>
</table>
<p>The following table shows the semantics of '<tt>vset</tt>' for
floating point types. If either operand is a floating point Not a
Number (NaN) value, the operation is unordered, and the value in the
first column below is produced at that position. Otherwise, the
operation is ordered, and the value in the second column is
produced.</p>
<table border="1" cellspacing="0" cellpadding="4">
<tbody>
<tr><th>Operation</th><th>If unordered<th>Otherwise true iff</th></tr>
<tr><td><tt>eq</tt></td><td>undefined</td><td>var1 == var2</td></tr>
<tr><td><tt>ne</tt></td><td>undefined</td><td>var1 != var2</td></tr>
<tr><td><tt>lt</tt></td><td>undefined</td><td>var1 &lt; var2</td></tr>
<tr><td><tt>gt</tt></td><td>undefined</td><td>var1 &gt; var2</td></tr>
<tr><td><tt>le</tt></td><td>undefined</td><td>var1 &lt;= var2</td></tr>
<tr><td><tt>ge</tt></td><td>undefined</td><td>var1 &gt;= var2</td></tr>
<tr><td><tt>oeq</tt></td><td>false</td><td>var1 == var2</td></tr>
<tr><td><tt>one</tt></td><td>false</td><td>var1 != var2</td></tr>
<tr><td><tt>olt</tt></td><td>false</td><td>var1 &lt; var2</td></tr>
<tr><td><tt>ogt</tt></td><td>false</td><td>var1 &gt; var2</td></tr>
<tr><td><tt>ole</tt></td><td>false</td><td>var1 &lt;= var2</td></tr>
<tr><td><tt>oge</tt></td><td>false</td><td>var1 &gt;= var2</td></tr>
<tr><td><tt>ueq</tt></td><td>true</td><td>var1 == var2</td></tr>
<tr><td><tt>une</tt></td><td>true</td><td>var1 != var2</td></tr>
<tr><td><tt>ult</tt></td><td>true</td><td>var1 &lt; var2</td></tr>
<tr><td><tt>ugt</tt></td><td>true</td><td>var1 &gt; var2</td></tr>
<tr><td><tt>ule</tt></td><td>true</td><td>var1 &lt;= var2</td></tr>
<tr><td><tt>uge</tt></td><td>true</td><td>var1 &gt;= var2</td></tr>
<tr><td><tt>o</tt></td><td>false</td><td>always</td></tr>
<tr><td><tt>u</tt></td><td>true</td><td>never</td></tr>
<tr><td><tt>true</tt></td><td>true</td><td>always</td></tr>
<tr><td><tt>false</tt></td><td>false</td><td>never</td></tr>
</tbody>
</table>
<h5>Example:</h5>
<pre> &lt;result&gt; = vset eq &lt;2 x int&gt; &lt;int 0, int 1&gt;, &lt;int 1, int 0&gt; <i>; yields {&lt;2 x bool&gt;}:result = false, false</i>
&lt;result&gt; = vset ne &lt;2 x int&gt; &lt;int 0, int 1&gt;, &lt;int 1, int 0&gt; <i>; yields {&lt;2 x bool&gt;}:result = true, true</i>
&lt;result&gt; = vset lt &lt;2 x int&gt; &lt;int 0, int 1&gt;, &lt;int 1, int 0&gt; <i>; yields {&lt;2 x bool&gt;}:result = true, false</i>
&lt;result&gt; = vset gt &lt;2 x int&gt; &lt;int 0, int 1&gt;, &lt;int 1, int 0&gt; <i>; yields {&lt;2 x bool&gt;}:result = false, true</i>
&lt;result&gt; = vset le &lt;2 x int&gt; &lt;int 0, int 1&gt;, &lt;int 1, int 0&gt; <i>; yields {&lt;2 x bool&gt;}:result = true, false</i>
&lt;result&gt; = vset ge &lt;2 x int&gt; &lt;int 0, int 1&gt;, &lt;int 1, int 0&gt; <i>; yields {&lt;2 x bool&gt;}:result = false, true</i>
</pre>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="i_vselect">'<tt>vselect</tt>' Instruction</a>
</div>
<div class="doc_text">
<h5>Syntax:</h5>
<pre>
&lt;result&gt; = vselect &lt;n x bool&gt; &lt;cond&gt;, &lt;n x &lt;ty&gt;&gt; &lt;val1&gt;, &lt;n x &lt;ty&gt;&gt; &lt;val2&gt; <i>; yields &lt;n x &lt;ty&gt;&gt;</i>
</pre>
<h5>Overview:</h5>
<p>
The '<tt>vselect</tt>' instruction chooses one value at each position
of a vector based on a condition.
</p>
<h5>Arguments:</h5>
<p>
The '<tt>vselect</tt>' instruction requires a <a
href="#t_packed">packed</a> <tt>bool</tt> value indicating the
condition at each vector position, and two values of the same packed
type. All three operands must have the same length. The type of the
result is the same as the type of the two value operands.</p>
<h5>Semantics:</h5>
<p>
At each position where the <tt>bool</tt> vector is true, that position
of the result gets its value from the first value argument; otherwise,
it gets its value from the second value argument.
</p>
<h5>Example:</h5>
<pre>
%X = vselect bool &lt;2 x bool&gt; &lt;bool true, bool false&gt;, &lt;2 x ubyte&gt; &lt;ubyte 17, ubyte 17&gt;,
&lt;2 x ubyte&gt; &lt;ubyte 42, ubyte 42&gt; <i>; yields &lt;2 x ubyte&gt;:17, 42</i>
</pre>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">