Removing unimplemented vector instructions from language referrence.
[oota-llvm.git] / docs / LangRef.html
index ab0d66d96ed844329503a5b1ddcc74354021ea55..2be38d42a89cd8da9be1620590494235e699c623 100644 (file)
           <li><a href="#i_shr">'<tt>shr</tt>' Instruction</a></li>
         </ol>
       </li>
+      <li><a href="#vectorops">Vector Operations</a>
+        <ol>
+          <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_shufflevector">'<tt>shufflevector</tt>' Instruction</a></li>
+        </ol>
+      </li>
       <li><a href="#memoryops">Memory Access Operations</a>
         <ol>
           <li><a href="#i_malloc">'<tt>malloc</tt>'   Instruction</a></li>
           <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_vsetint">'<tt>vsetint</tt>' Instruction</a></li>
-          <li><a href="#i_vsetfp">'<tt>vsetfp</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>
           <li><a href="#i_va_arg">'<tt>va_arg</tt>'  Instruction</a></li>
         </ol>
@@ -584,7 +586,7 @@ a power of 2.</p>
 
 <!-- ======================================================================= -->
 <div class="doc_subsection">
-  <a name="moduleasm">Module-Level Inline Assembly</a></li>
+  <a name="moduleasm">Module-Level Inline Assembly</a>
 </div>
 
 <div class="doc_text">
@@ -1135,6 +1137,12 @@ following is the syntax for constant expressions:</p>
   <dd>Perform the <a href="#i_insertelement">insertelement
   operation</a> on constants.
 
+
+  <dt><b><tt>shufflevector ( VEC1, VEC2, IDXMASK )</tt></b></dt>
+
+  <dd>Perform the <a href="#i_shufflevector">shufflevector
+  operation</a> on constants.
+
   <dt><b><tt>OPCODE ( LHS, RHS )</tt></b></dt>
 
   <dd>Perform the specified operation of the LHS and RHS constants. OPCODE may 
@@ -1887,6 +1895,168 @@ positions.</p>
 </pre>
 </div>
 
+<!-- ======================================================================= -->
+<div class="doc_subsection"> 
+  <a name="vectorops">Vector Operations</a>
+</div>
+
+<div class="doc_text">
+
+<p>LLVM supports several instructions to represent vector operations in a
+target-independent manner.  This instructions cover the element-access and
+vector-specific operations needed to process vectors effectively.  While LLVM
+does directly support these vector operations, many sophisticated algorithms
+will want to use target-specific intrinsics to take full advantage of a specific
+target.</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+   <a name="i_extractelement">'<tt>extractelement</tt>' Instruction</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+
+<pre>
+  &lt;result&gt; = extractelement &lt;n x &lt;ty&gt;&gt; &lt;val&gt;, uint &lt;idx&gt;    <i>; yields &lt;ty&gt;</i>
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>extractelement</tt>' instruction extracts a single scalar
+element from a packed vector at a specified index.
+</p>
+
+
+<h5>Arguments:</h5>
+
+<p>
+The first operand of an '<tt>extractelement</tt>' instruction is a
+value of <a href="#t_packed">packed</a> type.  The second operand is
+an index indicating the position from which to extract the element.
+The index may be a variable.</p>
+
+<h5>Semantics:</h5>
+
+<p>
+The result is a scalar of the same type as the element type of
+<tt>val</tt>.  Its value is the value at position <tt>idx</tt> of
+<tt>val</tt>.  If <tt>idx</tt> exceeds the length of <tt>val</tt>, the
+results are undefined.
+</p>
+
+<h5>Example:</h5>
+
+<pre>
+  %result = extractelement &lt;4 x int&gt; %vec, uint 0    <i>; yields int</i>
+</pre>
+</div>
+
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+   <a name="i_insertelement">'<tt>insertelement</tt>' Instruction</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+
+<pre>
+  &lt;result&gt; = insertelement &lt;n x &lt;ty&gt;&gt; &lt;val&gt;, &lt;ty&gt; &lt;elt&gt, uint &lt;idx&gt;    <i>; yields &lt;n x &lt;ty&gt;&gt;</i>
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>insertelement</tt>' instruction inserts a scalar
+element into a packed vector at a specified index.
+</p>
+
+
+<h5>Arguments:</h5>
+
+<p>
+The first operand of an '<tt>insertelement</tt>' instruction is a
+value of <a href="#t_packed">packed</a> type.  The second operand is a
+scalar value whose type must equal the element type of the first
+operand.  The third operand is an index indicating the position at
+which to insert the value.  The index may be a variable.</p>
+
+<h5>Semantics:</h5>
+
+<p>
+The result is a packed vector of the same type as <tt>val</tt>.  Its
+element values are those of <tt>val</tt> except at position
+<tt>idx</tt>, where it gets the value <tt>elt</tt>.  If <tt>idx</tt>
+exceeds the length of <tt>val</tt>, the results are undefined.
+</p>
+
+<h5>Example:</h5>
+
+<pre>
+  %result = insertelement &lt;4 x int&gt; %vec, int 1, uint 0    <i>; yields &lt;4 x int&gt;</i>
+</pre>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+   <a name="i_shufflevector">'<tt>shufflevector</tt>' Instruction</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+
+<pre>
+  &lt;result&gt; = shufflevector &lt;n x &lt;ty&gt;&gt; &lt;v1&gt;, &lt;n x &lt;ty&gt;&gt; &lt;v2&gt;, &lt;n x uint&gt; &lt;mask&gt;    <i>; yields &lt;n x &lt;ty&gt;&gt;</i>
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>shufflevector</tt>' instruction constructs a permutation of elements
+from two input vectors, returning a vector of the same type.
+</p>
+
+<h5>Arguments:</h5>
+
+<p>
+The first two operands of a '<tt>shufflevector</tt>' instruction are vectors
+with types that match each other and types that match the result of the
+instruction.  The third argument is a shuffle mask, which has the same number
+of elements as the other vector type, but whose element type is always 'uint'.
+</p>
+
+<p>
+The shuffle mask operand is required to be a constant vector with either
+constant integer or undef values.
+</p>
+
+<h5>Semantics:</h5>
+
+<p>
+The elements of the two input vectors are numbered from left to right across
+both of the vectors.  The shuffle mask operand specifies, for each element of
+the result vector, which element of the two input registers the result element
+gets.  The element selector may be undef (meaning "don't care") and the second
+operand may be undef if performing a shuffle from only one vector.
+</p>
+
+<h5>Example:</h5>
+
+<pre>
+  %result = shufflevector &lt;4 x int&gt; %v1, &lt;4 x int&gt; %v2, 
+                          &lt;4 x uint&gt; &lt;uint 0, uint 4, uint 1, uint 5&gt;    <i>; yields &lt;4 x int&gt;</i>
+  %result = shufflevector &lt;4 x int&gt; %v1, &lt;4 x int&gt; undef, 
+                          &lt;4 x uint&gt; &lt;uint 0, uint 1, uint 2, uint 3&gt;  <i>; yields &lt;4 x int&gt;</i> - Identity shuffle.
+</pre>
+</div>
+
 <!-- ======================================================================= -->
 <div class="doc_subsection"> 
   <a name="memoryops">Memory Access Operations</a>
@@ -2331,283 +2501,6 @@ value argument; otherwise, it returns the second value argument.
 </pre>
 </div>
 
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_vsetint">'<tt>vsetint</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-<pre>&lt;result&gt; = vsetint &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>vsetint</tt>' instruction takes two integer vectors and
-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>vsetint</tt>' instruction are a comparison
-operation and two value arguments.  The value arguments must be of <a
-href="#t_integral">integral</a> <a href="#t_packed">packed</a> type,
-and they must have identical types.  The operation argument must be
-one of <tt>eq</tt>, <tt>ne</tt>, <tt>slt</tt>, <tt>sgt</tt>,
-<tt>sle</tt>, <tt>sge</tt>, <tt>ult</tt>, <tt>ugt</tt>, <tt>ule</tt>,
-<tt>uge</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>vsetint</tt>'.  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>vsetint
-slt <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>slt</tt></td><td>var1 &lt; var2</td><td>signed</td></tr>
-    <tr><td><tt>sgt</tt></td><td>var1 &gt; var2</td><td>signed</td></tr>
-    <tr><td><tt>sle</tt></td><td>var1 &lt;= var2</td><td>signed</td></tr>
-    <tr><td><tt>sge</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>
-
-<h5>Example:</h5>
-<pre>  &lt;result&gt; = vsetint 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; = vsetint 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; = vsetint slt &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; = vsetint sgt &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; = vsetint sle &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; = vsetint sge &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_vsetfp">'<tt>vsetfp</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-<pre>&lt;result&gt; = vsetfp &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>vsetfp</tt>' instruction takes two floating point vector
-arguments and 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>vsetfp</tt>' instruction are a comparison
-operation and two value arguments.  The value arguments must be of <a
-href="t_floating">floating point</a> <a href="#t_packed">packed</a>
-type, and they must have identical types.  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>vsetfp</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; = vsetfp eq &lt;2 x float&gt; &lt;float 0.0, float 1.0&gt;, &lt;float 1.0, float 0.0&gt;      <i>; yields {&lt;2 x bool&gt;}:result = false, false</i>
-  &lt;result&gt; = vsetfp ne &lt;2 x float&gt; &lt;float 0.0, float 1.0&gt;, &lt;float 1.0, float 0.0&gt;      <i>; yields {&lt;2 x bool&gt;}:result = true, true</i>
-  &lt;result&gt; = vsetfp lt &lt;2 x float&gt; &lt;float 0.0, float 1.0&gt;, &lt;float 1.0, float 0.0&gt;      <i>; yields {&lt;2 x bool&gt;}:result = true, false</i>
-  &lt;result&gt; = vsetfp gt &lt;2 x float&gt; &lt;float 0.0, float 1.0&gt;, &lt;float 1.0, float 0.0&gt;      <i>; yields {&lt;2 x bool&gt;}:result = false, true</i>
-  &lt;result&gt; = vsetfp le &lt;2 x float&gt; &lt;float 0.0, float 1.0&gt;, &lt;float 1.0, float 0.0&gt;      <i>; yields {&lt;2 x bool&gt;}:result = true, false</i>
-  &lt;result&gt; = vsetfp ge &lt;2 x float&gt; &lt;float 0.0, float 1.0&gt;, &lt;float 1.0, float 0.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">
-   <a name="i_extractelement">'<tt>extractelement</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-
-<pre>
-  &lt;result&gt; = extractelement &lt;n x &lt;ty&gt;&gt; &lt;val&gt;, uint &lt;idx&gt;    <i>; yields &lt;ty&gt;</i>
-</pre>
-
-<h5>Overview:</h5>
-
-<p>
-The '<tt>extractelement</tt>' instruction extracts a single scalar
-element from a packed vector at a specified index.
-</p>
-
-
-<h5>Arguments:</h5>
-
-<p>
-The first operand of an '<tt>extractelement</tt>' instruction is a
-value of <a href="#t_packed">packed</a> type.  The second operand is
-an index indicating the position from which to extract the element.
-The index may be a variable.</p>
-
-<h5>Semantics:</h5>
-
-<p>
-The result is a scalar of the same type as the element type of
-<tt>val</tt>.  Its value is the value at position <tt>idx</tt> of
-<tt>val</tt>.  If <tt>idx</tt> exceeds the length of <tt>val</tt>, the
-results are undefined.
-</p>
-
-<h5>Example:</h5>
-
-<pre>
-  %result = extractelement &lt;4 x int&gt; %vec, uint 0    <i>; yields int</i>
-</pre>
-</div>
-
-
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
-   <a name="i_insertelement">'<tt>insertelement</tt>' Instruction</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-
-<pre>
-  &lt;result&gt; = insertelement &lt;n x &lt;ty&gt;&gt; &lt;val&gt;, &lt;ty&gt; &lt;elt&gt, uint &lt;idx&gt;    <i>; yields &lt;n x &lt;ty&gt;&gt;</i>
-</pre>
-
-<h5>Overview:</h5>
-
-<p>
-The '<tt>insertelement</tt>' instruction inserts a scalar
-element into a packed vector at a specified index.
-</p>
-
-
-<h5>Arguments:</h5>
-
-<p>
-The first operand of an '<tt>insertelement</tt>' instruction is a
-value of <a href="#t_packed">packed</a> type.  The second operand is a
-scalar value whose type must equal the element type of the first
-operand.  The third operand is an index indicating the position at
-which to insert the value.  The index may be a variable.</p>
-
-<h5>Semantics:</h5>
-
-<p>
-The result is a packed vector of the same type as <tt>val</tt>.  Its
-element values are those of <tt>val</tt> except at position
-<tt>idx</tt>, where it gets the value <tt>elt</tt>.  If <tt>idx</tt>
-exceeds the length of <tt>val</tt>, the results are undefined.
-</p>
-
-<h5>Example:</h5>
-
-<pre>
-  %result = insertelement &lt;4 x int&gt; %vec, int 1, uint 0    <i>; yields &lt;4 x int&gt;</i>
-</pre>
-</div>
-
 
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection">