Typo.
[oota-llvm.git] / docs / LangRef.html
index 566911452731acd49e27935b3950bb21203d7d03..25ac4cbde1b6be025f5884d5519f5faeeb5a3ac2 100644 (file)
@@ -27,6 +27,7 @@
       <li><a href="#aliasstructure">Aliases</a>
       <li><a href="#paramattrs">Parameter Attributes</a></li>
       <li><a href="#gc">Garbage Collector Names</a></li>
+      <li><a href="#notes">Function Notes</a></li>
       <li><a href="#moduleasm">Module-Level Inline Assembly</a></li>
       <li><a href="#datalayout">Data Layout</a></li>
     </ol>
@@ -801,7 +802,7 @@ a power of 2.</p>
 
 <div class="doc_code">
 <pre>
-@&lt;Name&gt; = [Linkage] [Visibility] alias &lt;AliaseeTy&gt; @&lt;Aliasee&gt;
+@&lt;Name&gt; = alias [Linkage] [Visibility] &lt;AliaseeTy&gt; @&lt;Aliasee&gt;
 </pre>
 </div>
 
@@ -917,33 +918,34 @@ the named garbage collection algorithm.</p>
 </div>
 
 <div class="doc_text">
-<p>Each function may specify function notes.</p>
+<p>The function definition may list function notes which are used by
+various passes.</p>
 
 <div class="doc_code">
-<pre>define void @f() notes(inline=Always) { ... }</pre>
-<pre>define void @f() notes(inline=Always,opt-size) { ... }</pre>
-<pre>define void @f() notes(inline=Never,opt-size) { ... }</pre>
-<pre>define void @f() notes(opt-size) { ... }</pre>
+<pre>
+define void @f() notes(inline=Always) { ... }
+define void @f() notes(inline=Always,opt-size) { ... }
+define void @f() notes(inline=Never,opt-size) { ... }
+define void @f() notes(opt-size) { ... }
+</pre>
 </div>
 
-<p>
-<li>inline=Always
-<p>
-This note requests inliner to inline this function irrespective of
-inlining size threshold for this function.
-</p></li>
-<li>inline=Never
-<p>
-This note requests inliner to never inline this function in any situation. 
-This note may not be used together with inline=Always note.
-</p></li>
-<li>opt-size
-<p>
-This note suggests optimization passes and code generator passes to make 
-choices that help reduce code size.
-</p></li>
-<p>
-The notes that are not documented here are considered invalid notes.
+<dl>
+<dt><tt>inline=Always</tt></dt>
+<dd>This note requests inliner to inline this function irrespective of inlining
+size threshold for this function.</dd>
+
+<dt><tt>inline=Never</tt></dt>
+<dd>This note requests inliner to never inline this function in any situation.
+This note may not be used together with <tt>inline=Always</tt> note.</dd>
+
+<dt><tt>opt-size</tt></dt>
+<dd>This note suggests optimization passes and code generator passes to make 
+choices that help reduce code size.</dd>
+
+</dl>
+
+<p>Any notes that are not documented here are considered invalid notes.</p>
 </div>
 
 <!-- ======================================================================= -->
@@ -1393,7 +1395,8 @@ instruction.</p>
     <td class="left"><tt>&lt; { i32, i32, i32 } &gt;</tt></td>
     <td class="left">A triple of three <tt>i32</tt> values</td>
   </tr><tr class="layout">
-  <td class="left"><tt>&lt; { float, i32 (i32)* } &gt;</tt></td>
+  <td class="left">
+<tt>&lt;&nbsp;{&nbsp;float,&nbsp;i32&nbsp;(i32)*&nbsp;}&nbsp;&gt;</tt></td>
     <td class="left">A pair, where the first element is a <tt>float</tt> and the
       second element is a <a href="#t_pointer">pointer</a> to a
       <a href="#t_function">function</a> that takes an <tt>i32</tt>, returning
@@ -1726,7 +1729,8 @@ following is the syntax for constant expressions:</p>
   was stored to memory and read back as TYPE. In other words, no bits change 
   with this operator, just the type.  This can be used for conversion of
   vector types to any other type, as long as they have the same bit width. For
-  pointers it is only valid to cast to another pointer type.
+  pointers it is only valid to cast to another pointer type. It is not valid
+  to bitcast to or from an aggregate type.
   </dd>
 
   <dt><b><tt>getelementptr ( CSTPTR, IDX0, IDX1, ... )</tt></b></dt>
@@ -2608,7 +2612,7 @@ values.  Both arguments must have identical types.</p>
 <h5>Semantics:</h5>
 <p>The truth table used for the '<tt>and</tt>' instruction is:</p>
 <p> </p>
-<div style="align: center">
+<div>
 <table border="1" cellspacing="0" cellpadding="4">
   <tbody>
     <tr>
@@ -2663,7 +2667,7 @@ values.  Both arguments must have identical types.</p>
 <h5>Semantics:</h5>
 <p>The truth table used for the '<tt>or</tt>' instruction is:</p>
 <p> </p>
-<div style="align: center">
+<div>
 <table border="1" cellspacing="0" cellpadding="4">
   <tbody>
     <tr>
@@ -2720,7 +2724,7 @@ values.  Both arguments must have identical types.</p>
 
 <p>The truth table used for the '<tt>xor</tt>' instruction is:</p>
 <p> </p>
-<div style="align: center">
+<div>
 <table border="1" cellspacing="0" cellpadding="4">
   <tbody>
     <tr>
@@ -3805,8 +3809,9 @@ nothing is done (<i>no-op cast</i>).</p>
 <h5>Arguments:</h5>
 
 <p>The '<tt>bitcast</tt>' instruction takes a value to cast, which must be 
-a first class value, and a type to cast it to, which must also be a <a
-  href="#t_firstclass">first class</a> type. The bit sizes of <tt>value</tt>
+a non-aggregate first class value, and a type to cast it to, which must also be
+a non-aggregate <a href="#t_firstclass">first class</a> type. The bit sizes of
+<tt>value</tt>
 and the destination type, <tt>ty2</tt>, must be identical. If the source
 type is a pointer, the destination type must also be a pointer.  This
 instruction supports bitwise conversion of vectors to integers and to vectors
@@ -3841,11 +3846,12 @@ instructions, which defy better classification.</p>
 </div>
 <div class="doc_text">
 <h5>Syntax:</h5>
-<pre>  &lt;result&gt; = icmp &lt;cond&gt; &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {i1}:result</i>
+<pre>  &lt;result&gt; = icmp &lt;cond&gt; &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;   <i>; yields {i1} or {&lt;N x i1&gt}:result</i>
 </pre>
 <h5>Overview:</h5>
-<p>The '<tt>icmp</tt>' instruction returns a boolean value based on comparison
-of its two integer or pointer operands.</p>
+<p>The '<tt>icmp</tt>' instruction returns a boolean value or
+a vector of boolean values based on comparison
+of its two integer, integer vector, or pointer operands.</p>
 <h5>Arguments:</h5>
 <p>The '<tt>icmp</tt>' instruction takes three operands. The first operand is
 the condition code indicating the kind of comparison to perform. It is not
@@ -3863,11 +3869,13 @@ a value, just a keyword. The possible condition code are:
   <li><tt>sle</tt>: signed less or equal</li>
 </ol>
 <p>The remaining two arguments must be <a href="#t_integer">integer</a> or
-<a href="#t_pointer">pointer</a> typed. They must also be identical types.</p>
+<a href="#t_pointer">pointer</a>
+or integer <a href="#t_vector">vector</a> typed.
+They must also be identical types.</p>
 <h5>Semantics:</h5>
 <p>The '<tt>icmp</tt>' compares <tt>op1</tt> and <tt>op2</tt> according to 
 the condition code given as <tt>cond</tt>. The comparison performed always
-yields a <a href="#t_primitive">i1</a> result, as follows: 
+yields either an <a href="#t_primitive"><tt>i1</tt></a> or vector of <tt>i1</tt> result, as follows: 
 <ol>
   <li><tt>eq</tt>: yields <tt>true</tt> if the operands are equal, 
   <tt>false</tt> otherwise. No sign interpretation is necessary or performed.
@@ -3893,6 +3901,11 @@ yields a <a href="#t_primitive">i1</a> result, as follows:
 </ol>
 <p>If the operands are <a href="#t_pointer">pointer</a> typed, the pointer
 values are compared as if they were integers.</p>
+<p>If the operands are integer vectors, then they are compared
+element by element. The result is an <tt>i1</tt> vector with
+the same number of elements as the values being compared.
+Otherwise, the result is an <tt>i1</tt>.
+</p>
 
 <h5>Example:</h5>
 <pre>  &lt;result&gt; = icmp eq i32 4, 5          <i>; yields: result=false</i>
@@ -3909,11 +3922,19 @@ values are compared as if they were integers.</p>
 </div>
 <div class="doc_text">
 <h5>Syntax:</h5>
-<pre>  &lt;result&gt; = fcmp &lt;cond&gt; &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;     <i>; yields {i1}:result</i>
+<pre>  &lt;result&gt; = fcmp &lt;cond&gt; &lt;ty&gt; &lt;op1&gt;, &lt;op2&gt;     <i>; yields {i1} or {&lt;N x i1&gt}:result</i>
 </pre>
 <h5>Overview:</h5>
-<p>The '<tt>fcmp</tt>' instruction returns a boolean value based on comparison
-of its floating point operands.</p>
+<p>The '<tt>fcmp</tt>' instruction returns a boolean value
+or vector of boolean values based on comparison
+of its operands.
+<p>
+If the operands are floating point scalars, then the result
+type is a boolean (<a href="#t_primitive"><tt>i1</tt></a>).
+</p>
+<p>If the operands are floating point vectors, then the result type
+is a vector of boolean with the same number of elements as the
+operands being compared.</p>
 <h5>Arguments:</h5>
 <p>The '<tt>fcmp</tt>' instruction takes three operands. The first operand is
 the condition code indicating the kind of comparison to perform. It is not
@@ -3938,13 +3959,17 @@ a value, just a keyword. The possible condition code are:
 </ol>
 <p><i>Ordered</i> means that neither operand is a QNAN while
 <i>unordered</i> means that either operand may be a QNAN.</p>
-<p>The <tt>val1</tt> and <tt>val2</tt> arguments must be
-<a href="#t_floating">floating point</a> typed.  They must have identical 
-types.</p>
+<p>Each of <tt>val1</tt> and <tt>val2</tt> arguments must be
+either a <a href="#t_floating">floating point</a> type
+or a <a href="#t_vector">vector</a> of floating point type.
+They must have identical types.</p>
 <h5>Semantics:</h5>
 <p>The '<tt>fcmp</tt>' instruction compares <tt>op1</tt> and <tt>op2</tt>
-according to the condition code given as <tt>cond</tt>. The comparison performed 
-always yields a <a href="#t_primitive">i1</a> result, as follows: 
+according to the condition code given as <tt>cond</tt>.
+If the operands are vectors, then the vectors are compared
+element by element.
+Each comparison performed 
+always yields an <a href="#t_primitive">i1</a> result, as follows: 
 <ol>
   <li><tt>false</tt>: always yields <tt>false</tt>, regardless of operands.</li>
   <li><tt>oeq</tt>: yields <tt>true</tt> if both operands are not a QNAN and 
@@ -3978,9 +4003,9 @@ always yields a <a href="#t_primitive">i1</a> result, as follows:
 
 <h5>Example:</h5>
 <pre>  &lt;result&gt; = fcmp oeq float 4.0, 5.0    <i>; yields: result=false</i>
-  &lt;result&gt; = icmp one float 4.0, 5.0    <i>; yields: result=true</i>
-  &lt;result&gt; = icmp olt float 4.0, 5.0    <i>; yields: result=true</i>
-  &lt;result&gt; = icmp ueq double 1.0, 2.0   <i>; yields: result=false</i>
+  &lt;result&gt; = fcmp one float 4.0, 5.0    <i>; yields: result=true</i>
+  &lt;result&gt; = fcmp olt float 4.0, 5.0    <i>; yields: result=true</i>
+  &lt;result&gt; = fcmp ueq double 1.0, 2.0   <i>; yields: result=false</i>
 </pre>
 </div>
 
@@ -4011,7 +4036,7 @@ a value, just a keyword. The possible condition code are:
   <li><tt>slt</tt>: signed less than</li>
   <li><tt>sle</tt>: signed less or equal</li>
 </ol>
-<p>The remaining two arguments must be <a href="#t_vector">vector</a> o
+<p>The remaining two arguments must be <a href="#t_vector">vector</a> or
 <a href="#t_integer">integer</a> typed. They must also be identical types.</p>
 <h5>Semantics:</h5>
 <p>The '<tt>vicmp</tt>' instruction compares <tt>op1</tt> and <tt>op2</tt>
@@ -4135,7 +4160,9 @@ Loop:       ; Infinite loop that counts from 0 on up...
 <h5>Syntax:</h5>
 
 <pre>
-  &lt;result&gt; = select i1 &lt;cond&gt;, &lt;ty&gt; &lt;val1&gt;, &lt;ty&gt; &lt;val2&gt;             <i>; yields ty</i>
+  &lt;result&gt; = select <i>selty</i> &lt;cond&gt;, &lt;ty&gt; &lt;val1&gt;, &lt;ty&gt; &lt;val2&gt;             <i>; yields ty</i>
+
+  <i>selty</i> is either i1 or {&lt;N x i1&gt}
 </pre>
 
 <h5>Overview:</h5>
@@ -4149,18 +4176,25 @@ condition, without branching.
 <h5>Arguments:</h5>
 
 <p>
-The '<tt>select</tt>' instruction requires an 'i1' value indicating the
+The '<tt>select</tt>' instruction requires an 'i1' value or
+a vector of 'i1' values indicating the
 condition, and two values of the same <a href="#t_firstclass">first class</a>
-type.  If the val1/val2 are vectors, the entire vectors are selected, not
+type.  If the val1/val2 are vectors and
+the condition is a scalar, then entire vectors are selected, not
 individual elements.
 </p>
 
 <h5>Semantics:</h5>
 
 <p>
-If the i1 condition evaluates is 1, the instruction returns the first
+If the condition is an i1 and it evaluates to 1, the instruction returns the first
 value argument; otherwise, it returns the second value argument.
 </p>
+<p>
+If the condition is a vector of i1, then the value arguments must
+be vectors of the same size, and the selection is done element 
+by element.
+</p>
 
 <h5>Example:</h5>