<li><a href="#functionstructure">Functions</a></li>
<li><a href="#aliasstructure">Aliases</a>
<li><a href="#paramattrs">Parameter Attributes</a></li>
+ <li><a href="#fnattrs">Function Attributes</a></li>
<li><a href="#gc">Garbage Collector Names</a></li>
<li><a href="#moduleasm">Module-Level Inline Assembly</a></li>
<li><a href="#datalayout">Data Layout</a></li>
<div class="doc_code">
<pre>
-@<Name> = [Linkage] [Visibility] alias <AliaseeTy> @<Aliasee>
+@<Name> = alias [Linkage] [Visibility] <AliaseeTy> @<Aliasee>
</pre>
</div>
<div class="doc_code">
<pre>
-declare i32 @printf(i8* noalias , ...) nounwind
-declare i32 @atoi(i8*) nounwind readonly
+declare i32 @printf(i8* noalias , ...)
+declare i32 @atoi(i8 zeroext*)
</pre>
</div>
a call to this function.</dd>
<dt><tt>inreg</tt></dt>
- <dd>This indicates that the parameter should be placed in register (if
- possible) during assembling function call. Support for this attribute is
- target-specific</dd>
+ <dd>This indicates that this parameter or return value should be treated
+ in a special target-dependent fashion during while emitting code for a
+ function call or return (usually, by putting it in a register as opposed
+ to memory; in some places it is used to distinguish between two different
+ kinds of registers). Use of this attribute is target-specific</dd>
<dt><tt>byval</tt></dt>
<dd>This indicates that the pointer parameter should really be passed by
parameter. The caller is responsible for ensuring that this is the case,
usually by placing the value in a stack allocation.</dd>
- <dt><tt>noreturn</tt></dt>
- <dd>This function attribute indicates that the function never returns. This
- indicates to LLVM that every call to this function should be treated as if
- an <tt>unreachable</tt> instruction immediately followed the call.</dd>
-
- <dt><tt>nounwind</tt></dt>
- <dd>This function attribute indicates that no exceptions unwind out of the
- function. Usually this is because the function makes no use of exceptions,
- but it may also be that the function catches any exceptions thrown when
- executing it.</dd>
-
<dt><tt>nest</tt></dt>
<dd>This indicates that the pointer parameter can be excised using the
<a href="#int_trampoline">trampoline intrinsics</a>.</dd>
- <dt><tt>readonly</tt></dt>
- <dd>This function attribute indicates that the function has no side-effects
- except for producing a return value or throwing an exception. The value
- returned must only depend on the function arguments and/or global variables.
- It may use values obtained by dereferencing pointers.</dd>
- <dt><tt>readnone</tt></dt>
- <dd>A <tt>readnone</tt> function has the same restrictions as a <tt>readonly</tt>
- function, but in addition it is not allowed to dereference any pointer arguments
- or global variables.
</dl>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
- <a name="notes">Function Notes</a>
+ <a name="fnattrs">Function Attributes</a>
</div>
<div class="doc_text">
-<p>Each function may specify function notes.</p>
+
+<p>Function attributes are set to communicate additional information about
+ a function. Function attributes are considered to be part of the function,
+ not of the function type, so functions with different parameter attributes
+ can have the same function type.</p>
+
+ <p>Function attributes are simple keywords that follow the type specified. If
+ multiple attributes are needed, they are space separated. For
+ example:</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() noinline { ... }
+define void @f() alwaysinline { ... }
+define void @f() alwaysinline optsize { ... }
+define void @f() optsize
+</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>alwaysinline</tt></dt>
+<dd>This attribute requests inliner to inline this function irrespective of
+inlining size threshold for this function.</dd>
+
+<dt><tt>noinline</tt></dt>
+<dd>This attributes requests inliner to never inline this function in any
+situation. This attribute may not be used together with <tt>alwaysinline</tt>
+ attribute.</dd>
+
+<dt><tt>optsize</tt></dt>
+<dd>This attribute suggests that optimization passes and code generator passes
+make choices that help reduce code size.</dd>
+
+<dt><tt>noreturn</tt></dt>
+<dd>This function attribute indicates that the function never returns. This
+ tells LLVM that every call to this function should be treated as if
+ an <tt>unreachable</tt> instruction immediately followed the call.</dd>
+
+<dt><tt>nounwind</tt></dt>
+<dd>This function attribute indicates that no exceptions unwind out of the
+ function. Usually this is because the function makes no use of exceptions,
+ but it may also be that the function catches any exceptions thrown when
+ executing it.</dd>
+
+<dt><tt>readonly</tt></dt>
+<dd>This function attribute indicates that the function has no side-effects
+ except for producing a return value or throwing an exception. The value
+ returned must only depend on the function arguments and/or global variables.
+ It may use values obtained by dereferencing pointers.</dd>
+<dt><tt>readnone</tt></dt>
+<dd>A <tt>readnone</tt> function has the same restrictions as a <tt>readonly</tt>
+ function, but in addition it is not allowed to dereference any pointer arguments
+ or global variables.
+</dl>
+
</div>
<!-- ======================================================================= -->
<td class="left"><tt>< { i32, i32, i32 } ></tt></td>
<td class="left">A triple of three <tt>i32</tt> values</td>
</tr><tr class="layout">
- <td class="left"><tt>< { float, i32 (i32)* } ></tt></td>
+ <td class="left">
+<tt>< { float, i32 (i32)* } ></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
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>
<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>
<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>
<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>
<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
</div>
<div class="doc_text">
<h5>Syntax:</h5>
-<pre> <result> = icmp <cond> <ty> <op1>, <op2> <i>; yields {i1}:result</i>
+<pre> <result> = icmp <cond> <ty> <op1>, <op2> <i>; yields {i1} or {<N x i1>}: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
<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.
</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> <result> = icmp eq i32 4, 5 <i>; yields: result=false</i>
</div>
<div class="doc_text">
<h5>Syntax:</h5>
-<pre> <result> = fcmp <cond> <ty> <op1>, <op2> <i>; yields {i1}:result</i>
+<pre> <result> = fcmp <cond> <ty> <op1>, <op2> <i>; yields {i1} or {<N x i1>}: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
</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
<h5>Example:</h5>
<pre> <result> = fcmp oeq float 4.0, 5.0 <i>; yields: result=false</i>
- <result> = icmp one float 4.0, 5.0 <i>; yields: result=true</i>
- <result> = icmp olt float 4.0, 5.0 <i>; yields: result=true</i>
- <result> = icmp ueq double 1.0, 2.0 <i>; yields: result=false</i>
+ <result> = fcmp one float 4.0, 5.0 <i>; yields: result=true</i>
+ <result> = fcmp olt float 4.0, 5.0 <i>; yields: result=true</i>
+ <result> = fcmp ueq double 1.0, 2.0 <i>; yields: result=false</i>
</pre>
</div>
<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> of
+<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>
<h5>Syntax:</h5>
<pre>
- <result> = select i1 <cond>, <ty> <val1>, <ty> <val2> <i>; yields ty</i>
+ <result> = select <i>selty</i> <cond>, <ty> <val1>, <ty> <val2> <i>; yields ty</i>
+
+ <i>selty</i> is either i1 or {<N x i1>}
</pre>
<h5>Overview:</h5>
<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>