</li>
<li><a href="#bitwiseops">Bitwise Binary Operations</a>
<ol>
- <li><a href="#i_and">'<tt>and</tt>' Instruction</a></li>
- <li><a href="#i_or">'<tt>or</tt>' Instruction</a></li>
- <li><a href="#i_xor">'<tt>xor</tt>' Instruction</a></li>
<li><a href="#i_shl">'<tt>shl</tt>' Instruction</a></li>
<li><a href="#i_lshr">'<tt>lshr</tt>' Instruction</a></li>
<li><a href="#i_ashr">'<tt>ashr</tt>' Instruction</a></li>
+ <li><a href="#i_and">'<tt>and</tt>' Instruction</a></li>
+ <li><a href="#i_or">'<tt>or</tt>' Instruction</a></li>
+ <li><a href="#i_xor">'<tt>xor</tt>' Instruction</a></li>
</ol>
</li>
<li><a href="#vectorops">Vector Operations</a>
<li><a href="#i_memcpy">'<tt>llvm.memcpy.*</tt>' Intrinsic</a></li>
<li><a href="#i_memmove">'<tt>llvm.memmove.*</tt>' Intrinsic</a></li>
<li><a href="#i_memset">'<tt>llvm.memset.*</tt>' Intrinsic</a></li>
- <li><a href="#i_isunordered">'<tt>llvm.isunordered.*</tt>' Intrinsic</a></li>
<li><a href="#i_sqrt">'<tt>llvm.sqrt.*</tt>' Intrinsic</a></li>
<li><a href="#i_powi">'<tt>llvm.powi.*</tt>' Intrinsic</a></li>
</ol>
For example, %foo, %DivisionByZero, %a.really.long.identifier. The actual
regular expression used is '<tt>%[a-zA-Z$._][a-zA-Z$._0-9]*</tt>'.
Identifiers which require other characters in their names can be surrounded
- with quotes. In this way, anything except a <tt>"</tt> character can be used
+ with quotes. In this way, anything except a <tt>"</tt> character can be used
in a name.</li>
<li>Unnamed values are represented as an unsigned numeric value with a '%'
an internal global value may cause the internal to be renamed as necessary to
avoid collisions. Because the symbol is internal to the module, all
references can be updated. This corresponds to the notion of the
- '<tt>static</tt>' keyword in C, or the idea of "anonymous namespaces" in C++.
+ '<tt>static</tt>' keyword in C.
</dd>
<dt><tt><b><a name="linkage_linkonce">linkonce</a></b></tt>: </dt>
- <dd>"<tt>linkonce</tt>" linkage is similar to <tt>internal</tt> linkage, with
- the twist that linking together two modules defining the same
- <tt>linkonce</tt> globals will cause one of the globals to be discarded. This
- is typically used to implement inline functions. Unreferenced
- <tt>linkonce</tt> globals are allowed to be discarded.
+ <dd>Globals with "<tt>linkonce</tt>" linkage are merged with other globals of
+ the same name when linkage occurs. This is typically used to implement
+ inline functions, templates, or other code which must be generated in each
+ translation unit that uses it. Unreferenced <tt>linkonce</tt> globals are
+ allowed to be discarded.
</dd>
<dt><tt><b><a name="linkage_weak">weak</a></b></tt>: </dt>
<dd>"<tt>weak</tt>" linkage is exactly the same as <tt>linkonce</tt> linkage,
except that unreferenced <tt>weak</tt> globals may not be discarded. This is
- used to implement constructs in C such as "<tt>i32 X;</tt>" at global scope.
+ used for globals that may be emitted in multiple translation units, but that
+ are not guaranteed to be emitted into every translation unit that uses them.
+ One example of this are common globals in C, such as "<tt>int X;</tt>" at
+ global scope.
</dd>
<dt><tt><b><a name="linkage_appending">appending</a></b></tt>: </dt>
"sections" with identical names when .o files are linked.
</dd>
+ <dt><tt><b><a name="linkage_externweak">extern_weak</a></b></tt>: </dt>
+ <dd>The semantics of this linkage follow the ELF model: the symbol is weak
+ until linked, if not linked, the symbol becomes null instead of being an
+ undefined reference.
+ </dd>
+</dl>
+
<dt><tt><b><a name="linkage_external">externally visible</a></b></tt>:</dt>
<dd>If none of the above identifiers are used, the global is externally
external symbol references.
</dd>
- <dt><tt><b><a name="linkage_externweak">extern_weak</a></b></tt>: </dt>
-
- <dd>"<tt>extern_weak</tt>" TBD
- </dd>
-
<p>
The next two types of linkage are targeted for Microsoft Windows platform
only. They are designed to support importing (exporting) symbols from (to)
DLLs.
</p>
+ <dl>
<dt><tt><b><a name="linkage_dllimport">dllimport</a></b></tt>: </dt>
<dd>"<tt>dllimport</tt>" linkage causes the compiler to reference a function
</dl>
-<p><a name="linkage_external">For example, since the "<tt>.LC0</tt>"
+<p><a name="linkage_external"></a>For example, since the "<tt>.LC0</tt>"
variable is defined to be internal, if another module defined a "<tt>.LC0</tt>"
variable and was linked with this one, one of the two would be renamed,
preventing a collision. Since "<tt>main</tt>" and "<tt>puts</tt>" are
external (i.e., lacking any linkage declarations), they are accessible
-outside of the current module. It is illegal for a function <i>declaration</i>
-to have any linkage type other than "externally visible".</a></p>
+outside of the current module.</p>
+<p>It is illegal for a function <i>declaration</i>
+to have any linkage type other than "externally visible", <tt>dllimport</tt>,
+or <tt>extern_weak</tt>.</p>
</div>
<dd>This calling convention (the default if no other calling convention is
specified) matches the target C calling conventions. This calling convention
supports varargs function calls and tolerates some mismatch in the declared
- prototype and implemented declaration of the function (as does normal C). For
- integer arguments less than 32-bits, the value will be sign-extended to
- 32-bits before the call is made. If zero-extension is required, use the
- <tt>cextcc</tt> calling convention.
- </dd>
-
- <dt><b>"<tt>cextcc(bitmask)</tt>" - The C with explicit extend calling
- convention </b>:</dt>
- <dd>This calling convention is exactly like the C calling convention except
- that it is parameterized to provide a <tt>bitmask</tt> that indicates how
- integer arguments of less than 32-bits should be extended. A zero bit
- indicates zero-extension while a 1-bit indicates sign-extension. The least
- significant bit always corresponds to the return type of the function. The
- bits in the <tt>bitmask</tt> are assigned to the integer parameters of the
- function that are smaller than 32-bits. For example, a bitmask of value
- 5 (0b0101) indicates that the return value is to be sign extended, the first
- small integer argument is to be zero extended and the second small integer
- argument is to be sign extended.</dd>
-
-
- <dt><b>"<tt>csretcc</tt>" - The C struct return calling convention</b>:</dt>
-
- <dd>This calling convention matches the target C calling conventions, except
- that functions with this convention are required to take a pointer as their
- first argument, and the return type of the function must be void. This is
- used for C functions that return aggregates by-value. In this case, the
- function has been transformed to take a pointer to the struct as the first
- argument to the function. For targets where the ABI specifies specific
- behavior for structure-return calls, the calling convention can be used to
- distinguish between struct return functions and other functions that take a
- pointer to a struct as the first argument.
+ prototype and implemented declaration of the function (as does normal C).
</dd>
- <dt><b>"<tt>csretextcc(bitmask)</tt>" - The C struct return with explicit
- extend calling convention</b>:</dt>
- <dd>This calling convention is exactly like the <tt>csret</tt> calling
- convention except that it is parameterized to provide a <tt>bitmask</tt>
- that indicates how integer arguments of less than 32-bits should be extended.
- A zero bit indicates zero-extension while a 1-bit indicates sign-extension.
- </dd>
-
<dt><b>"<tt>fastcc</tt>" - The fast calling convention</b>:</dt>
<dd>This calling convention attempts to make calls as fast as possible
</div>
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+ <a name="visibility">Visibility Styles</a>
+</div>
+
+<div class="doc_text">
+
+<p>
+All Global Variables and Functions have one of the following visibility styles:
+</p>
+
+<dl>
+ <dt><b>"<tt>default</tt>" - Default style</b>:</dt>
+
+ <dd>On ELF, default visibility means that the declaration is visible to other
+ modules and, in shared libraries, means that the declared entity may be
+ overridden. On Darwin, default visibility means that the declaration is
+ visible to other modules. Default visibility corresponds to "external
+ linkage" in the language.
+ </dd>
+
+ <dt><b>"<tt>hidden</tt>" - Hidden style</b>:</dt>
+
+ <dd>Two declarations of an object with hidden visibility refer to the same
+ object if they are in the same shared object. Usually, hidden visibility
+ indicates that the symbol will not be placed into the dynamic symbol table,
+ so no other module (executable or shared library) can reference it
+ directly.
+ </dd>
+
+</dl>
+
+</div>
+
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="globalvars">Global Variables</a>
global is forced to have at least that much alignment. All alignments must be
a power of 2.</p>
+<p>For example, the following defines a global with an initializer, section,
+ and alignment:</p>
+
+<pre>
+ %G = constant float 1.0, section "foo", align 4
+</pre>
+
</div>
<p>LLVM function definitions consist of the "<tt>define</tt>" keyord,
an optional <a href="#linkage">linkage type</a>, an optional
+<a href="#visibility">visibility style</a>, an optional
<a href="#callingconv">calling convention</a>, a return type, an optional
<a href="#paramattrs">parameter attribute</a> for the return type, a function
name, a (possibly empty) argument list (each with optional
-<a href="#paramattrs">parameter attributes</a>), an optional section, an
-optional alignment, an opening curly brace, a list of basic blocks, and a
-closing curly brace. LLVM function declarations
-consist of the "<tt>declare</tt>" keyword, an optional <a
- href="#callingconv">calling convention</a>, a return type, an optional
+<a href="#paramattrs">parameter attributes</a>), an optional section, an
+optional alignment, an opening curly brace, a list of basic blocks, and a
+closing curly brace.
+
+LLVM function declarations consist of the "<tt>declare</tt>" keyword, an
+optional <a href="#linkage">linkage type</a>, an optional
+<a href="#visibility">visibility style</a>, an optional
+<a href="#callingconv">calling convention</a>, a return type, an optional
<a href="#paramattrs">parameter attribute</a> for the return type, a function
name, a possibly empty list of arguments, and an optional alignment.</p>
type so two functions types that differ only by the parameter attributes
are different function types.</p>
- <p>Parameter attributes consist of an at sign (@) followed by either a single
- keyword or a comma separate list of keywords enclosed in parentheses. For
- example:<pre>
- %someFunc = i16 @zext (i8 @(sext) %someParam)
- %someFunc = i16 @zext (i8 @zext %someParam)</pre>
- Note that the two function types above are unique because the parameter
- has a different attribute (@sext in the first one, @zext in the second).</p>
-
- <p>Currently, only the following parameter attributes are defined:
+ <p>Parameter attributes are simple keywords that follow the type specified. If
+ multiple parameter attributes are needed, they are space separated. For
+ example:</p><pre>
+ %someFunc = i16 (i8 sext %someParam) zext
+ %someFunc = i16 (i8 zext %someParam) zext</pre>
+ <p>Note that the two function types above are unique because the parameter has
+ a different attribute (sext in the first one, zext in the second). Also note
+ that the attribute for the function result (zext) comes immediately after the
+ argument list.</p>
+
+ <p>Currently, only the following parameter attributes are defined:</p>
<dl>
- <dt><tt>@zext</tt></dt>
+ <dt><tt>zext</tt></dt>
<dd>This indicates that the parameter should be zero extended just before
a call to this function.</dd>
- <dt><tt>@sext</tt></dt>
+ <dt><tt>sext</tt></dt>
<dd>This indicates that the parameter should be sign extended just before
a call to this function.</dd>
- </dl></p>
+ <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>
+ <dt><tt>sret</tt></dt>
+ <dd>This indicates that the parameter specifies the address of a structure
+ that is the return value of the function in the source program.
+ </dd>
+ </dl>
- <p>The current motivation for parameter attributes is to enable the sign and
- zero extend information necessary for the C calling convention to be passed
- from the front end to LLVM. The <tt>@zext</tt> and <tt>@sext</tt> attributes
- are used by the code generator to perform the required extension. However,
- parameter attributes are an orthogonal feature to calling conventions and
- may be used for other purposes in the future.</p>
</div>
<!-- ======================================================================= -->
<tbody>
<tr><th>Type</th><th>Description</th></tr>
<tr><td><tt>void</tt></td><td>No value</td></tr>
- <tr><td><tt>i8</tt></td><td>Signless 8-bit value</td></tr>
- <tr><td><tt>i32</tt></td><td>Signless 32-bit value</td></tr>
+ <tr><td><tt>i8</tt></td><td>8-bit value</td></tr>
+ <tr><td><tt>i32</tt></td><td>32-bit value</td></tr>
<tr><td><tt>float</tt></td><td>32-bit floating point value</td></tr>
<tr><td><tt>label</tt></td><td>Branch destination</td></tr>
</tbody>
<table>
<tbody>
<tr><th>Type</th><th>Description</th></tr>
- <tr><td><tt>bool</tt></td><td>True or False value</td></tr>
- <tr><td><tt>i16</tt></td><td>Signless 16-bit value</td></tr>
- <tr><td><tt>i64</tt></td><td>Signless 64-bit value</td></tr>
+ <tr><td><tt>i1</tt></td><td>True or False value</td></tr>
+ <tr><td><tt>i16</tt></td><td>16-bit value</td></tr>
+ <tr><td><tt>i64</tt></td><td>64-bit value</td></tr>
<tr><td><tt>double</tt></td><td>64-bit floating point value</td></tr>
</tbody>
</table>
<tr><th>Classification</th><th>Types</th></tr>
<tr>
<td><a name="t_integer">integer</a></td>
- <td><tt>i8, i16, i32, i64</tt></td>
- </tr>
- <tr>
- <td><a name="t_integral">integral</a></td>
- <td><tt>bool, i8, i16, i32, i64</tt>
- </td>
+ <td><tt>i1, i8, i16, i32, i64</tt></td>
</tr>
<tr>
<td><a name="t_floating">floating point</a></td>
</tr>
<tr>
<td><a name="t_firstclass">first class</a></td>
- <td><tt>bool, i8, i16, i32, i64, float, double, <br/>
+ <td><tt>i1, i8, i16, i32, i64, float, double, <br/>
<a href="#t_pointer">pointer</a>,<a href="#t_packed">packed</a></tt>
</td>
</tr>
<td class="left">
<tt>[40 x i32 ]</tt><br/>
<tt>[41 x i32 ]</tt><br/>
- <tt>[40 x i32]</tt><br/>
+ <tt>[40 x i8]</tt><br/>
</td>
<td class="left">
- Array of 40 integer values.<br/>
- Array of 41 integer values.<br/>
- Array of 40 unsigned integer values.<br/>
+ Array of 40 32-bit integer values.<br/>
+ Array of 41 32-bit integer values.<br/>
+ Array of 40 8-bit integer values.<br/>
</td>
</tr>
</table>
<td class="left">
<tt>[3 x [4 x i32]]</tt><br/>
<tt>[12 x [10 x float]]</tt><br/>
- <tt>[2 x [3 x [4 x i32]]]</tt><br/>
+ <tt>[2 x [3 x [4 x i16]]]</tt><br/>
</td>
<td class="left">
- 3x4 array of integer values.<br/>
+ 3x4 array of 32-bit integer values.<br/>
12x10 array of single precision floating point values.<br/>
- 2x3x4 array of unsigned integer values.<br/>
+ 2x3x4 array of 16-bit integer values.<br/>
</td>
</tr>
</table>
<td class="left">function taking an <tt>i32</tt>, returning an <tt>i32</tt>
</td>
</tr><tr class="layout">
- <td class="left"><tt>float (i16 @sext, i32 *) *
+ <td class="left"><tt>float (i16 sext, i32 *) *
</tt></td>
<td class="left"><a href="#t_pointer">Pointer</a> to a function that takes
an <tt>i16</tt> that should be sign extended and a
</tr><tr class="layout">
<td class="left"><tt>i32 (i8*, ...)</tt></td>
<td class="left">A vararg function that takes at least one
- <a href="#t_pointer">pointer</a> to <tt>i8 </tt> (signed char in C),
+ <a href="#t_pointer">pointer</a> to <tt>i8 </tt> (char in C),
which returns an integer. This is the signature for <tt>printf</tt> in
LLVM.
</td>
</pre>
<p>The number of elements is a constant integer value; elementtype may
-be any integral or floating point type.</p>
+be any integer or floating point type.</p>
<h5>Examples:</h5>
<td class="left">
<tt><4 x i32></tt><br/>
<tt><8 x float></tt><br/>
- <tt><2 x i32></tt><br/>
+ <tt><2 x i64></tt><br/>
</td>
<td class="left">
- Packed vector of 4 integer values.<br/>
+ Packed vector of 4 32-bit integer values.<br/>
Packed vector of 8 floating-point values.<br/>
- Packed vector of 2 unsigned integer values.<br/>
+ Packed vector of 2 64-bit integer values.<br/>
</td>
</tr>
</table>
<dt><b>Boolean constants</b></dt>
<dd>The two strings '<tt>true</tt>' and '<tt>false</tt>' are both valid
- constants of the <tt><a href="#t_primitive">bool</a></tt> type.
+ constants of the <tt><a href="#t_primitive">i1</a></tt> type.
</dd>
<dt><b>Integer constants</b></dt>
<dd>Standard integers (such as '4') are constants of the <a
- href="#t_integer">integer</a> type. Negative numbers may be used with signed
+ href="#t_integer">integer</a> type. Negative numbers may be used with
integer types.
</dd>
<dl>
<dt><b><tt>trunc ( CST to TYPE )</tt></b></dt>
<dd>Truncate a constant to another type. The bit size of CST must be larger
- than the bit size of TYPE. Both types must be integral.</dd>
+ than the bit size of TYPE. Both types must be integers.</dd>
<dt><b><tt>zext ( CST to TYPE )</tt></b></dt>
<dd>Zero extend a constant to another type. The bit size of CST must be
- smaller or equal to the bit size of TYPE. Both types must be integral.</dd>
+ smaller or equal to the bit size of TYPE. Both types must be integers.</dd>
<dt><b><tt>sext ( CST to TYPE )</tt></b></dt>
<dd>Sign extend a constant to another type. The bit size of CST must be
- smaller or equal to the bit size of TYPE. Both types must be integral.</dd>
+ smaller or equal to the bit size of TYPE. Both types must be integers.</dd>
<dt><b><tt>fptrunc ( CST to TYPE )</tt></b></dt>
<dd>Truncate a floating point constant to another floating point type. The
<div class="doc_subsubsection"> <a name="i_br">'<tt>br</tt>' Instruction</a> </div>
<div class="doc_text">
<h5>Syntax:</h5>
-<pre> br bool <cond>, label <iftrue>, label <iffalse><br> br label <dest> <i>; Unconditional branch</i>
+<pre> br i1 <cond>, label <iftrue>, label <iffalse><br> br label <dest> <i>; Unconditional branch</i>
</pre>
<h5>Overview:</h5>
<p>The '<tt>br</tt>' instruction is used to cause control flow to
and an unconditional branch.</p>
<h5>Arguments:</h5>
<p>The conditional branch form of the '<tt>br</tt>' instruction takes a
-single '<tt>bool</tt>' value and two '<tt>label</tt>' values. The
+single '<tt>i1</tt>' value and two '<tt>label</tt>' values. The
unconditional form of the '<tt>br</tt>' instruction takes a single '<tt>label</tt>'
value as a target.</p>
<h5>Semantics:</h5>
-<p>Upon execution of a conditional '<tt>br</tt>' instruction, the '<tt>bool</tt>'
+<p>Upon execution of a conditional '<tt>br</tt>' instruction, the '<tt>i1</tt>'
argument is evaluated. If the value is <tt>true</tt>, control flows
to the '<tt>iftrue</tt>' <tt>label</tt> argument. If "cond" is <tt>false</tt>,
control flows to the '<tt>iffalse</tt>' <tt>label</tt> argument.</p>
<h5>Example:</h5>
-<pre>Test:<br> %cond = <a href="#i_icmp">icmp</a> eq, i32 %a, %b<br> br bool %cond, label %IfEqual, label %IfUnequal<br>IfEqual:<br> <a
+<pre>Test:<br> %cond = <a href="#i_icmp">icmp</a> eq, i32 %a, %b<br> br i1 %cond, label %IfEqual, label %IfUnequal<br>IfEqual:<br> <a
href="#i_ret">ret</a> i32 1<br>IfUnequal:<br> <a href="#i_ret">ret</a> i32 0<br></pre>
</div>
<!-- _______________________________________________________________________ -->
<pre>
<i>; Emulate a conditional br instruction</i>
- %Val = <a href="#i_zext">zext</a> bool %value to i32
+ %Val = <a href="#i_zext">zext</a> i1 %value to i32
switch i32 %Val, label %truedest [i32 0, label %falsedest ]
<i>; Emulate an unconditional br instruction</i>
<h5>Semantics:</h5>
<p>The value produced is the integer or floating point product of the
two operands.</p>
-<p>There is no signed vs unsigned multiplication. The appropriate
-action is taken based on the type of the operand.</p>
+<p>Because the operands are the same width, the result of an integer
+multiplication is the same whether the operands should be deemed unsigned or
+signed.</p>
<h5>Example:</h5>
<pre> <result> = mul i32 4, %var <i>; yields {i32}:result = 4 * %var</i>
</pre>
and produce a single value. The resulting value of the bitwise binary
operators is always the same type as its first operand.</p>
</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_shl">'<tt>shl</tt>'
+Instruction</a> </div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> <result> = shl <ty> <var1>, <var2> <i>; yields {ty}:result</i>
+</pre>
+<h5>Overview:</h5>
+<p>The '<tt>shl</tt>' instruction returns the first operand shifted to
+the left a specified number of bits.</p>
+<h5>Arguments:</h5>
+<p>Both arguments to the '<tt>shl</tt>' instruction must be the same <a
+ href="#t_integer">integer</a> type.</p>
+<h5>Semantics:</h5>
+<p>The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup>.</p>
+<h5>Example:</h5><pre>
+ <result> = shl i32 4, %var <i>; yields {i32}: 4 << %var</i>
+ <result> = shl i32 4, 2 <i>; yields {i32}: 16</i>
+ <result> = shl i32 1, 10 <i>; yields {i32}: 1024</i>
+</pre>
+</div>
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_lshr">'<tt>lshr</tt>'
+Instruction</a> </div>
+<div class="doc_text">
+<h5>Syntax:</h5>
+<pre> <result> = lshr <ty> <var1>, <var2> <i>; yields {ty}:result</i>
+</pre>
+
+<h5>Overview:</h5>
+<p>The '<tt>lshr</tt>' instruction (logical shift right) returns the first
+operand shifted to the right a specified number of bits.</p>
+
+<h5>Arguments:</h5>
+<p>Both arguments to the '<tt>lshr</tt>' instruction must be the same
+<a href="#t_integer">integer</a> type.</p>
+
+<h5>Semantics:</h5>
+<p>This instruction always performs a logical shift right operation. The most
+significant bits of the result will be filled with zero bits after the
+shift.</p>
+
+<h5>Example:</h5>
+<pre>
+ <result> = lshr i32 4, 1 <i>; yields {i32}:result = 2</i>
+ <result> = lshr i32 4, 2 <i>; yields {i32}:result = 1</i>
+ <result> = lshr i8 4, 3 <i>; yields {i8}:result = 0</i>
+ <result> = lshr i8 -2, 1 <i>; yields {i8}:result = 0x7FFFFFFF </i>
+</pre>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="i_ashr">'<tt>ashr</tt>'
+Instruction</a> </div>
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre> <result> = ashr <ty> <var1>, <var2> <i>; yields {ty}:result</i>
+</pre>
+
+<h5>Overview:</h5>
+<p>The '<tt>ashr</tt>' instruction (arithmetic shift right) returns the first
+operand shifted to the right a specified number of bits.</p>
+
+<h5>Arguments:</h5>
+<p>Both arguments to the '<tt>ashr</tt>' instruction must be the same
+<a href="#t_integer">integer</a> type.</p>
+
+<h5>Semantics:</h5>
+<p>This instruction always performs an arithmetic shift right operation,
+The most significant bits of the result will be filled with the sign bit
+of <tt>var1</tt>.</p>
+
+<h5>Example:</h5>
+<pre>
+ <result> = ashr i32 4, 1 <i>; yields {i32}:result = 2</i>
+ <result> = ashr i32 4, 2 <i>; yields {i32}:result = 1</i>
+ <result> = ashr i8 4, 3 <i>; yields {i8}:result = 0</i>
+ <result> = ashr i8 -2, 1 <i>; yields {i8}:result = -1</i>
+</pre>
+</div>
+
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="i_and">'<tt>and</tt>'
Instruction</a> </div>
its two operands.</p>
<h5>Arguments:</h5>
<p>The two arguments to the '<tt>and</tt>' instruction must be <a
- href="#t_integral">integral</a> values. Both arguments must have
+ href="#t_integer">integer</a> values. Both arguments must have
identical types.</p>
<h5>Semantics:</h5>
<p>The truth table used for the '<tt>and</tt>' instruction is:</p>
or of its two operands.</p>
<h5>Arguments:</h5>
<p>The two arguments to the '<tt>or</tt>' instruction must be <a
- href="#t_integral">integral</a> values. Both arguments must have
+ href="#t_integer">integer</a> values. Both arguments must have
identical types.</p>
<h5>Semantics:</h5>
<p>The truth table used for the '<tt>or</tt>' instruction is:</p>
"one's complement" operation, which is the "~" operator in C.</p>
<h5>Arguments:</h5>
<p>The two arguments to the '<tt>xor</tt>' instruction must be <a
- href="#t_integral">integral</a> values. Both arguments must have
+ href="#t_integer">integer</a> values. Both arguments must have
identical types.</p>
<h5>Semantics:</h5>
<p>The truth table used for the '<tt>xor</tt>' instruction is:</p>
<result> = xor i32 %V, -1 <i>; yields {i32}:result = ~%V</i>
</pre>
</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_shl">'<tt>shl</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-<pre> <result> = shl <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i>
-</pre>
-<h5>Overview:</h5>
-<p>The '<tt>shl</tt>' instruction returns the first operand shifted to
-the left a specified number of bits.</p>
-<h5>Arguments:</h5>
-<p>The first argument to the '<tt>shl</tt>' instruction must be an <a
- href="#t_integer">integer</a> type. The second argument must be an '<tt>i8</tt>'
-type.</p>
-<h5>Semantics:</h5>
-<p>The value produced is <tt>var1</tt> * 2<sup><tt>var2</tt></sup>.</p>
-<h5>Example:</h5>
-<pre> <result> = shl i32 4, i8 %var <i>; yields {i32}:result = 4 << %var</i>
- <result> = shl i32 4, i8 2 <i>; yields {i32}:result = 16</i>
- <result> = shl i32 1, i8 10 <i>; yields {i32}:result = 1024</i>
-</pre>
-</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_lshr">'<tt>lshr</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-<h5>Syntax:</h5>
-<pre> <result> = lshr <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>lshr</tt>' instruction (logical shift right) returns the first
-operand shifted to the right a specified number of bits.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument to the '<tt>lshr</tt>' instruction must be an <a
- href="#t_integer">integer</a> type. The second argument must be an '<tt>i8</tt>' type.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction always performs a logical shift right operation, regardless
-of whether the arguments are unsigned or not. The <tt>var2</tt> most significant
-bits will be filled with zero bits after the shift.</p>
-
-<h5>Example:</h5>
-<pre>
- <result> = lshr i32 4, i8 1 <i>; yields {i32}:result = 2</i>
- <result> = lshr i32 4, i8 2 <i>; yields {i32}:result = 1</i>
- <result> = lshr i8 4, i8 3 <i>; yields {i8 }:result = 0</i>
- <result> = lshr i8 -2, i8 1 <i>; yields {i8 }:result = 0x7FFFFFFF </i>
-</pre>
-</div>
-
-<!-- ======================================================================= -->
-<div class="doc_subsubsection"> <a name="i_ashr">'<tt>ashr</tt>'
-Instruction</a> </div>
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre> <result> = ashr <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i>
-</pre>
-
-<h5>Overview:</h5>
-<p>The '<tt>ashr</tt>' instruction (arithmetic shift right) returns the first
-operand shifted to the right a specified number of bits.</p>
-
-<h5>Arguments:</h5>
-<p>The first argument to the '<tt>ashr</tt>' instruction must be an
-<a href="#t_integer">integer</a> type. The second argument must be an
-'<tt>i8</tt>' type.</p>
-
-<h5>Semantics:</h5>
-<p>This instruction always performs an arithmetic shift right operation,
-regardless of whether the arguments are signed or not. The <tt>var2</tt> most
-significant bits will be filled with the sign bit of <tt>var1</tt>.</p>
-
-<h5>Example:</h5>
-<pre>
- <result> = ashr i32 4, i8 1 <i>; yields {i32}:result = 2</i>
- <result> = ashr i32 4, i8 2 <i>; yields {i32}:result = 1</i>
- <result> = ashr i8 4, i8 3 <i>; yields {i8}:result = 0</i>
- <result> = ashr i8 -2, i8 1 <i>; yields {i8 }:result = -1</i>
-</pre>
-</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<p>
The '<tt>trunc</tt>' instruction takes a <tt>value</tt> to trunc, which must
be an <a href="#t_integer">integer</a> type, and a type that specifies the size
-and type of the result, which must be an <a href="#t_integral">integral</a>
+and type of the result, which must be an <a href="#t_integer">integer</a>
type. The bit size of <tt>value</tt> must be larger than the bit size of
<tt>ty2</tt>. Equal sized types are not allowed.</p>
<h5>Example:</h5>
<pre>
%X = trunc i32 257 to i8 <i>; yields i8:1</i>
- %Y = trunc i32 123 to bool <i>; yields bool:true</i>
+ %Y = trunc i32 123 to i1 <i>; yields i1:true</i>
+ %Y = trunc i32 122 to i1 <i>; yields i1:false</i>
</pre>
</div>
<h5>Arguments:</h5>
<p>The '<tt>zext</tt>' instruction takes a value to cast, which must be of
-<a href="#t_integral">integral</a> type, and a type to cast it to, which must
-also be of <a href="#t_integral">integral</a> type. The bit size of the
+<a href="#t_integer">integer</a> type, and a type to cast it to, which must
+also be of <a href="#t_integer">integer</a> type. The bit size of the
<tt>value</tt> must be smaller than the bit size of the destination type,
<tt>ty2</tt>.</p>
cast is considered a <i>no-op cast</i> because no bits change (only the type
changes).</p>
-<p>When zero extending from bool, the result will alwasy be either 0 or 1.</p>
+<p>When zero extending from i1, the result will always be either 0 or 1.</p>
<h5>Example:</h5>
<pre>
%X = zext i32 257 to i64 <i>; yields i64:257</i>
- %Y = zext bool true to i32 <i>; yields i32:1</i>
+ %Y = zext i1 true to i32 <i>; yields i32:1</i>
</pre>
</div>
<h5>Arguments:</h5>
<p>
The '<tt>sext</tt>' instruction takes a value to cast, which must be of
-<a href="#t_integral">integral</a> type, and a type to cast it to, which must
-also be of <a href="#t_integral">integral</a> type. The bit size of the
+<a href="#t_integer">integer</a> type, and a type to cast it to, which must
+also be of <a href="#t_integer">integer</a> type. The bit size of the
<tt>value</tt> must be smaller than the bit size of the destination type,
<tt>ty2</tt>.</p>
no bit filling is done and the cast is considered a <i>no-op cast</i> because
no bits change (only the type changes).</p>
-<p>When sign extending from bool, the extension always results in -1 or 0.</p>
+<p>When sign extending from i1, the extension always results in -1 or 0.</p>
<h5>Example:</h5>
<pre>
%X = sext i8 -1 to i16 <i>; yields i16 :65535</i>
- %Y = sext bool true to i32 <i>; yields i32:-1</i>
+ %Y = sext i1 true to i32 <i>; yields i32:-1</i>
</pre>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
- <a name="i_fp2uint">'<tt>fptoui .. to</tt>' Instruction</a>
+ <a name="i_fptoui">'<tt>fptoui .. to</tt>' Instruction</a>
</div>
<div class="doc_text">
<h5>Arguments:</h5>
<p>The '<tt>fp2uint</tt>' instruction takes a value to cast, which must be a
<a href="#t_floating">floating point</a> value, and a type to cast it to, which
-must be an <a href="#t_integral">integral</a> type.</p>
+must be an <a href="#t_integer">integer</a> type.</p>
<h5>Semantics:</h5>
<p> The '<tt>fp2uint</tt>' instruction converts its
towards zero) unsigned integer value. If the value cannot fit in <tt>ty2</tt>,
the results are undefined.</p>
-<p>When converting to bool, the conversion is done as a comparison against
-zero. If the <tt>value</tt> was zero, the bool result will be <tt>false</tt>.
-If the <tt>value</tt> was non-zero, the bool result will be <tt>true</tt>.</p>
+<p>When converting to i1, the conversion is done as a comparison against
+zero. If the <tt>value</tt> was zero, the i1 result will be <tt>false</tt>.
+If the <tt>value</tt> was non-zero, the i1 result will be <tt>true</tt>.</p>
<h5>Example:</h5>
<pre>
- %X = fp2uint double 123.0 to i32 <i>; yields i32:123</i>
- %Y = fp2uint float 1.0E+300 to bool <i>; yields bool:true</i>
+ %X = fp2uint double 123.0 to i32 <i>; yields i32:123</i>
+ %Y = fp2uint float 1.0E+300 to i1 <i>; yields i1:true</i>
%X = fp2uint float 1.04E+17 to i8 <i>; yields undefined:1</i>
</pre>
</div>
<h5>Arguments:</h5>
<p> The '<tt>fptosi</tt>' instruction takes a value to cast, which must be a
<a href="#t_floating">floating point</a> value, and a type to cast it to, which
-must also be an <a href="#t_integral">integral</a> type.</p>
+must also be an <a href="#t_integer">integer</a> type.</p>
<h5>Semantics:</h5>
<p>The '<tt>fptosi</tt>' instruction converts its
towards zero) signed integer value. If the value cannot fit in <tt>ty2</tt>,
the results are undefined.</p>
-<p>When converting to bool, the conversion is done as a comparison against
-zero. If the <tt>value</tt> was zero, the bool result will be <tt>false</tt>.
-If the <tt>value</tt> was non-zero, the bool result will be <tt>true</tt>.</p>
+<p>When converting to i1, the conversion is done as a comparison against
+zero. If the <tt>value</tt> was zero, the i1 result will be <tt>false</tt>.
+If the <tt>value</tt> was non-zero, the i1 result will be <tt>true</tt>.</p>
<h5>Example:</h5>
<pre>
- %X = fptosi double -123.0 to i32 <i>; yields i32:-123</i>
- %Y = fptosi float 1.0E-247 to bool <i>; yields bool:true</i>
+ %X = fptosi double -123.0 to i32 <i>; yields i32:-123</i>
+ %Y = fptosi float 1.0E-247 to i1 <i>; yields i1:true</i>
%X = fptosi float 1.04E+17 to i8 <i>; yields undefined:1</i>
</pre>
</div>
<h5>Arguments:</h5>
<p>The '<tt>uitofp</tt>' instruction takes a value to cast, which must be an
-<a href="#t_integral">integral</a> value, and a type to cast it to, which must
+<a href="#t_integer">integer</a> value, and a type to cast it to, which must
be a <a href="#t_floating">floating point</a> type.</p>
<h5>Semantics:</h5>
<h5>Arguments:</h5>
<p>The '<tt>sitofp</tt>' instruction takes a value to cast, which must be an
-<a href="#t_integral">integral</a> value, and a type to cast it to, which must be
+<a href="#t_integer">integer</a> value, and a type to cast it to, which must be
a <a href="#t_floating">floating point</a> type.</p>
<h5>Semantics:</h5>
<h5>Arguments:</h5>
<p>The '<tt>inttoptr</tt>' instruction takes an <a href="i_integer">integer</a>
value to cast, and a type to cast it to, which must be a
-<a href="#t_pointer">pointer</a> type. </tt>
+<a href="#t_pointer">pointer</a> type.
<h5>Semantics:</h5>
<p>The '<tt>inttoptr</tt>' instruction converts <tt>value</tt> to type
<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>
-and the destination type, <tt>ty2</tt>, must be identical.</p>
+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.</p>
<h5>Semantics:</h5>
<p>The '<tt>bitcast</tt>' instruction converts <tt>value</tt> to type
</div>
<div class="doc_text">
<h5>Syntax:</h5>
-<pre> <result> = icmp <cond> <ty> <var1>, <var2> <i>; yields {bool}:result</i>
+<pre> <result> = icmp <cond> <ty> <var1>, <var2>
+<i>; yields {i1}:result</i>
</pre>
<h5>Overview:</h5>
<p>The '<tt>icmp</tt>' instruction returns a boolean value based on comparison
<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 of <a href="#t_integral">integral</a>,
-<a href="#t_pointer">pointer</a> or a <a href="#t_packed">packed</a> integral
-type. They must have identical types.</p>
+<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>
<h5>Semantics:</h5>
<p>The '<tt>icmp</tt>' compares <tt>var1</tt> and <tt>var2</tt> according to
the condition code given as <tt>cond</tt>. The comparison performed always
-yields a <a href="#t_bool">bool</a> result, as follows:
+yields a <a href="#t_primitive">i1</a> 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.
<tt>true</tt> if <tt>var1</tt> is less than <tt>var2</tt>.</li>
<li><tt>sle</tt>: interprets the operands as signed values and yields
<tt>true</tt> if <tt>var1</tt> is less than or equal to <tt>var2</tt>.</li>
- </li>
</ol>
<p>If the operands are <a href="#t_pointer">pointer</a> typed, the pointer
values are treated as integers and then compared.</p>
-<p>If the operands are <a href="#t_packed">packed</a> typed, the elements of
-the vector are compared in turn and the predicate must hold for all
-elements.</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> <var1>, <var2> <i>; yields {bool}:result</i>
+<pre> <result> = fcmp <cond> <ty> <var1>, <var2>
+<i>; yields {i1}:result</i>
</pre>
<h5>Overview:</h5>
<p>The '<tt>fcmp</tt>' instruction returns a boolean value based on comparison
</ol>
<p>In the preceding, <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 of
-<a href="#t_floating">floating point</a>, or a <a href="#t_packed">packed</a>
-floating point type. They must have identical types.</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>In the foregoing, <i>ordered</i> means that neither operand is a QNAN and
<i>unordered</i> means that either operand is a QNAN.</p>
<h5>Semantics:</h5>
<p>The '<tt>fcmp</tt>' compares <tt>var1</tt> and <tt>var2</tt> according to
the condition code given as <tt>cond</tt>. The comparison performed always
-yields a <a href="#t_bool">bool</a> result, as follows:
+yields a <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
<li><tt>uno</tt>: yields <tt>true</tt> if either operand is a QNAN.</li>
<li><tt>true</tt>: always yields <tt>true</tt>, regardless of operands.</li>
</ol>
-<p>If the operands are <a href="#t_packed">packed</a> typed, the elements of
-the vector are compared in turn and the predicate must hold for all elements.
-</p>
<h5>Example:</h5>
<pre> <result> = fcmp oeq float 4.0, 5.0 <i>; yields: result=false</i>
<h5>Syntax:</h5>
<pre>
- <result> = select bool <cond>, <ty> <val1>, <ty> <val2> <i>; yields ty</i>
+ <result> = select i1 <cond>, <ty> <val1>, <ty> <val2> <i>; yields ty</i>
</pre>
<h5>Overview:</h5>
<h5>Example:</h5>
<pre>
- %X = select bool true, i8 17, i8 42 <i>; yields i8:17</i>
+ %X = select i1 true, i8 17, i8 42 <i>; yields i8:17</i>
</pre>
</div>
define i32 %test(i32 %X, ...) {
; Initialize variable argument processing
%ap = alloca i8 *
- call void %<a href="#i_va_start">llvm.va_start</a>(i8 ** %ap)
+ %ap2 = bitcast i8** %ap to i8*
+ call void %<a href="#i_va_start">llvm.va_start</a>(i8* %ap2)
; Read a single integer argument
%tmp = va_arg i8 ** %ap, i32
; Demonstrate usage of llvm.va_copy and llvm.va_end
%aq = alloca i8 *
- call void %<a href="#i_va_copy">llvm.va_copy</a>(i8 ** %aq, i8 ** %ap)
- call void %<a href="#i_va_end">llvm.va_end</a>(i8 ** %aq)
+ %aq2 = bitcast i8** %aq to i8*
+ call void %<a href="#i_va_copy">llvm.va_copy</a>(i8 *%aq2, i8* %ap2)
+ call void %<a href="#i_va_end">llvm.va_end</a>(i8* %aq2)
; Stop processing of arguments.
- call void %<a href="#i_va_end">llvm.va_end</a>(i8 ** %ap)
+ call void %<a href="#i_va_end">llvm.va_end</a>(i8* %ap2)
ret i32 %tmp
}
</pre>
<div class="doc_text">
<h5>Syntax:</h5>
-<pre> declare void %llvm.va_start(<va_list>* <arglist>)<br></pre>
+<pre> declare void %llvm.va_start(i8* <arglist>)<br></pre>
<h5>Overview:</h5>
<P>The '<tt>llvm.va_start</tt>' intrinsic initializes
<tt>*<arglist></tt> for subsequent use by <tt><a
<div class="doc_text">
<h5>Syntax:</h5>
-<pre> declare void %llvm.va_end(<va_list*> <arglist>)<br></pre>
+<pre> declare void %llvm.va_end(i8* <arglist>)<br></pre>
<h5>Overview:</h5>
+
<p>The '<tt>llvm.va_end</tt>' intrinsic destroys <tt><arglist></tt>
which has been initialized previously with <tt><a href="#i_va_start">llvm.va_start</a></tt>
or <tt><a href="#i_va_copy">llvm.va_copy</a></tt>.</p>
+
<h5>Arguments:</h5>
+
<p>The argument is a <tt>va_list</tt> to destroy.</p>
+
<h5>Semantics:</h5>
+
<p>The '<tt>llvm.va_end</tt>' intrinsic works just like the <tt>va_end</tt>
macro available in C. In a target-dependent way, it destroys the <tt>va_list</tt>.
Calls to <a href="#i_va_start"><tt>llvm.va_start</tt></a> and <a
href="#i_va_copy"><tt>llvm.va_copy</tt></a> must be matched exactly
with calls to <tt>llvm.va_end</tt>.</p>
+
</div>
<!-- _______________________________________________________________________ -->
<h5>Syntax:</h5>
<pre>
- declare void %llvm.va_copy(<va_list>* <destarglist>,
- <va_list>* <srcarglist>)
+ declare void %llvm.va_copy(i8* <destarglist>, i8* <srcarglist>)
</pre>
<h5>Overview:</h5>
</div>
-<!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection">
- <a name="i_isunordered">'<tt>llvm.isunordered.*</tt>' Intrinsic</a>
-</div>
-
-<div class="doc_text">
-
-<h5>Syntax:</h5>
-<pre>
- declare bool %llvm.isunordered.f32(float Val1, float Val2)
- declare bool %llvm.isunordered.f64(double Val1, double Val2)
-</pre>
-
-<h5>Overview:</h5>
-
-<p>
-The '<tt>llvm.isunordered</tt>' intrinsics return true if either or both of the
-specified floating point values is a NAN.
-</p>
-
-<h5>Arguments:</h5>
-
-<p>
-The arguments are floating point numbers of the same type.
-</p>
-
-<h5>Semantics:</h5>
-
-<p>
-If either or both of the arguments is a SNAN or QNAN, it returns true, otherwise
-false.
-</p>
-</div>
-
-
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="i_sqrt">'<tt>llvm.sqrt.*</tt>' Intrinsic</a>
<p>
The only argument is the value to be counted. The argument may be of any
-unsigned integer type. The return type must match the argument type.
+integer type. The return type must match the argument type.
</p>
<h5>Semantics:</h5>
<p>
The only argument is the value to be counted. The argument may be of any
-unsigned integer type. The return type must match the argument type.
+integer type. The return type must match the argument type.
</p>
<h5>Semantics:</h5>
<p>
The only argument is the value to be counted. The argument may be of any
-unsigned integer type. The return type must match the argument type.
+integer type. The return type must match the argument type.
</p>
<h5>Semantics:</h5>