diff options
Diffstat (limited to 'docs/LangRef.html')
-rw-r--r-- | docs/LangRef.html | 582 |
1 files changed, 306 insertions, 276 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html index 3af8b68a22..f87af54978 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -24,6 +24,7 @@ <li><a href="#callingconv">Calling Conventions</a></li> <li><a href="#globalvars">Global Variables</a></li> <li><a href="#functionstructure">Functions</a></li> + <li><a href="#paramattrs">Parameter Attributes</a></li> <li><a href="#moduleasm">Module-Level Inline Assembly</a></li> </ol> </li> @@ -248,7 +249,7 @@ accepts and what is considered 'well formed'. For example, the following instruction is syntactically okay, but not well formed:</p> <pre> - %x = <a href="#i_add">add</a> int 1, %x + %x = <a href="#i_add">add</a> i32 1, %x </pre> <p>...because the definition of <tt>%x</tt> does not dominate all of @@ -296,7 +297,7 @@ languages. There are keywords for different opcodes ('<tt><a href="#i_add">add</a></tt>', '<tt><a href="#i_bitcast">bitcast</a></tt>', '<tt><a href="#i_ret">ret</a></tt>', etc...), for primitive type names ('<tt><a -href="#t_void">void</a></tt>', '<tt><a href="#t_uint">uint</a></tt>', etc...), +href="#t_void">void</a></tt>', '<tt><a href="#t_primitive">i32</a></tt>', etc...), and others. These reserved words cannot conflict with variable names, because none of them start with a '%' character.</p> @@ -306,21 +307,21 @@ none of them start with a '%' character.</p> <p>The easy way:</p> <pre> - %result = <a href="#i_mul">mul</a> uint %X, 8 + %result = <a href="#i_mul">mul</a> i32 %X, 8 </pre> <p>After strength reduction:</p> <pre> - %result = <a href="#i_shl">shl</a> uint %X, ubyte 3 + %result = <a href="#i_shl">shl</a> i32 %X, i8 3 </pre> <p>And the hard way:</p> <pre> - <a href="#i_add">add</a> uint %X, %X <i>; yields {uint}:%0</i> - <a href="#i_add">add</a> uint %0, %0 <i>; yields {uint}:%1</i> - %result = <a href="#i_add">add</a> uint %1, %1 + <a href="#i_add">add</a> i32 %X, %X <i>; yields {i32}:%0</i> + <a href="#i_add">add</a> i32 %0, %0 <i>; yields {i32}:%1</i> + %result = <a href="#i_add">add</a> i32 %1, %1 </pre> <p>This last way of multiplying <tt>%X</tt> by 8 illustrates several @@ -364,25 +365,25 @@ symbol table entries. Here is an example of the "hello world" module:</p> <pre><i>; Declare the string constant as a global constant...</i> <a href="#identifiers">%.LC0</a> = <a href="#linkage_internal">internal</a> <a - href="#globalvars">constant</a> <a href="#t_array">[13 x sbyte]</a> c"hello world\0A\00" <i>; [13 x sbyte]*</i> + href="#globalvars">constant</a> <a href="#t_array">[13 x i8 ]</a> c"hello world\0A\00" <i>; [13 x i8 ]*</i> <i>; External declaration of the puts function</i> -<a href="#functionstructure">declare</a> int %puts(sbyte*) <i>; int(sbyte*)* </i> +<a href="#functionstructure">declare</a> i32 %puts(i8 *) <i>; i32(i8 *)* </i> <i>; Global variable / Function body section separator</i> implementation <i>; Definition of main function</i> -int %main() { <i>; int()* </i> - <i>; Convert [13x sbyte]* to sbyte *...</i> +define i32 %main() { <i>; i32()* </i> + <i>; Convert [13x i8 ]* to i8 *...</i> %cast210 = <a - href="#i_getelementptr">getelementptr</a> [13 x sbyte]* %.LC0, long 0, long 0 <i>; sbyte*</i> + href="#i_getelementptr">getelementptr</a> [13 x i8 ]* %.LC0, i64 0, i64 0 <i>; i8 *</i> <i>; Call puts function to write out the string to stdout...</i> <a - href="#i_call">call</a> int %puts(sbyte* %cast210) <i>; int</i> + href="#i_call">call</a> i32 %puts(i8 * %cast210) <i>; i32</i> <a - href="#i_ret">ret</a> int 0<br>}<br></pre> + href="#i_ret">ret</a> i32 0<br>}<br></pre> <p>This example is made up of a <a href="#globalvars">global variable</a> named "<tt>.LC0</tt>", an external declaration of the "<tt>puts</tt>" @@ -440,7 +441,7 @@ All Global Variables and Functions have one of the following types of linkage: <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>int X;</tt>" at global scope. + used to implement constructs in C such as "<tt>i32 X;</tt>" at global scope. </dd> <dt><tt><b><a name="linkage_appending">appending</a></b></tt>: </dt> @@ -646,14 +647,18 @@ a power of 2.</p> <div class="doc_text"> -<p>LLVM function definitions consist of an optional <a href="#linkage">linkage -type</a>, an optional <a href="#callingconv">calling convention</a>, a return -type, a function name, a (possibly empty) argument list, an optional section, -an optional alignment, an opening curly brace, -a list of basic blocks, and a closing curly brace. LLVM function declarations -are defined with the "<tt>declare</tt>" keyword, an optional <a -href="#callingconv">calling convention</a>, a return type, a function name, -a possibly empty list of arguments, and an optional alignment.</p> +<p>LLVM function definitions consist of the "<tt>define</tt>" keyord, +an optional <a href="#linkage">linkage type</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 +are consist of the "<tt>declare</tt>" keyword, 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> <p>A function definition contains a list of basic blocks, forming the CFG for the function. Each basic block may optionally start with a label (giving the @@ -684,6 +689,42 @@ a power of 2.</p> </div> <!-- ======================================================================= --> +<div class="doc_subsection"><a name="paramattrs">Parameter Attributes</a></div> +<div class="doc_text"> + <p>The return type and each parameter of a function type may have a set of + <i>parameter attributes</i> associated with them. Parameter attributes are + used to communicate additional information about the result or parameters of + a function. Parameter attributes are considered to be part of the function + type so two functions types that differ only by the parameter attributes + are different function types.</p> + + <p>Parameter attributes consist of a 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: + <dl> + <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> + <dd>This indicates that the parameter should be sign extended just before + a call to this function.</dd> + </dl></p> + + <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> + +<!-- ======================================================================= --> <div class="doc_subsection"> <a name="moduleasm">Module-Level Inline Assembly</a> </div> @@ -742,10 +783,8 @@ system. The current set of primitive types is as follows:</p> <tbody> <tr><th>Type</th><th>Description</th></tr> <tr><td><tt>void</tt></td><td>No value</td></tr> - <tr><td><tt>ubyte</tt></td><td>Unsigned 8-bit value</td></tr> - <tr><td><tt>ushort</tt></td><td>Unsigned 16-bit value</td></tr> - <tr><td><tt>uint</tt></td><td>Unsigned 32-bit value</td></tr> - <tr><td><tt>ulong</tt></td><td>Unsigned 64-bit 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>float</tt></td><td>32-bit floating point value</td></tr> <tr><td><tt>label</tt></td><td>Branch destination</td></tr> </tbody> @@ -756,11 +795,9 @@ system. The current set of primitive types is as follows:</p> <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>sbyte</tt></td><td>Signed 8-bit value</td></tr> - <tr><td><tt>short</tt></td><td>Signed 16-bit value</td></tr> - <tr><td><tt>int</tt></td><td>Signed 32-bit value</td></tr> - <tr><td><tt>long</tt></td><td>Signed 64-bit value</td></tr> - <tr><td><tt>double</tt></td><td>64-bit floating point 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>double</tt></td><td>64-bit floating point value</td></tr> </tbody> </table> </td> @@ -779,20 +816,12 @@ classifications:</p> <tbody> <tr><th>Classification</th><th>Types</th></tr> <tr> - <td><a name="t_signed">signed</a></td> - <td><tt>sbyte, short, int, long, float, double</tt></td> - </tr> - <tr> - <td><a name="t_unsigned">unsigned</a></td> - <td><tt>ubyte, ushort, uint, ulong</tt></td> - </tr> - <tr> <td><a name="t_integer">integer</a></td> - <td><tt>ubyte, sbyte, ushort, short, uint, int, ulong, long</tt></td> + <td><tt>i8, i16, i32, i64</tt></td> </tr> <tr> <td><a name="t_integral">integral</a></td> - <td><tt>bool, ubyte, sbyte, ushort, short, uint, int, ulong, long</tt> + <td><tt>bool, i8, i16, i32, i64</tt> </td> </tr> <tr> @@ -801,9 +830,9 @@ classifications:</p> </tr> <tr> <td><a name="t_firstclass">first class</a></td> - <td><tt>bool, ubyte, sbyte, ushort, short, uint, int, ulong, long,<br> - float, double, <a href="#t_pointer">pointer</a>, - <a href="#t_packed">packed</a></tt></td> + <td><tt>bool, i8, i16, i32, i64, float, double, <br/> + <a href="#t_pointer">pointer</a>,<a href="#t_packed">packed</a></tt> + </td> </tr> </tbody> </table> @@ -851,9 +880,9 @@ be any type with a size.</p> <table class="layout"> <tr class="layout"> <td class="left"> - <tt>[40 x int ]</tt><br/> - <tt>[41 x int ]</tt><br/> - <tt>[40 x uint]</tt><br/> + <tt>[40 x i32 ]</tt><br/> + <tt>[41 x i32 ]</tt><br/> + <tt>[40 x i32]</tt><br/> </td> <td class="left"> Array of 40 integer values.<br/> @@ -866,9 +895,9 @@ be any type with a size.</p> <table class="layout"> <tr class="layout"> <td class="left"> - <tt>[3 x [4 x int]]</tt><br/> + <tt>[3 x [4 x i32]]</tt><br/> <tt>[12 x [10 x float]]</tt><br/> - <tt>[2 x [3 x [4 x uint]]]</tt><br/> + <tt>[2 x [3 x [4 x i32]]]</tt><br/> </td> <td class="left"> 3x4 array of integer values.<br/> @@ -883,7 +912,7 @@ length array. Normally, accesses past the end of an array are undefined in LLVM (e.g. it is illegal to access the 5th element of a 3 element array). As a special case, however, zero length arrays are recognized to be variable length. This allows implementation of 'pascal style arrays' with the LLVM -type "{ int, [0 x float]}", for example.</p> +type "{ i32, [0 x float]}", for example.</p> </div> @@ -910,17 +939,18 @@ Variable argument functions can access their arguments with the <a <table class="layout"> <tr class="layout"> <td class="left"> - <tt>int (int)</tt> <br/> - <tt>float (int, int *) *</tt><br/> - <tt>int (sbyte *, ...)</tt><br/> + <tt>i32 (i32)</tt> <br/> + <tt>float (i16 @sext, i32 *) *</tt><br/> + <tt>i32 (i8*, ...)</tt><br/> </td> <td class="left"> - function taking an <tt>int</tt>, returning an <tt>int</tt><br/> + function taking an <tt>i32</tt>, returning an <tt>i32</tt><br/> <a href="#t_pointer">Pointer</a> to a function that takes an - <tt>int</tt> and a <a href="#t_pointer">pointer</a> to <tt>int</tt>, - returning <tt>float</tt>.<br/> - A vararg function that takes at least one <a href="#t_pointer">pointer</a> - to <tt>sbyte</tt> (signed char in C), which returns an integer. This is + <tt>i16</tt> that should be sign extended and a + <a href="#t_pointer">pointer</a> to <tt>i32</tt>, returning + <tt>float</tt>.<br/> + A vararg function that takes at least one <a href="#t_pointer">pointer</a> + to <tt>i8 </tt> (signed char in C), which returns an integer. This is the signature for <tt>printf</tt> in LLVM.<br/> </td> </tr> @@ -945,14 +975,14 @@ instruction.</p> <table class="layout"> <tr class="layout"> <td class="left"> - <tt>{ int, int, int }</tt><br/> - <tt>{ float, int (int) * }</tt><br/> + <tt>{ i32, i32, i32 }</tt><br/> + <tt>{ float, i32 (i32) * }</tt><br/> </td> <td class="left"> - a triple of three <tt>int</tt> values<br/> + a triple of three <tt>i32</tt> values<br/> 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>int</tt>, returning an <tt>int</tt>.<br/> + that takes an <tt>i32</tt>, returning an <tt>i32</tt>.<br/> </td> </tr> </table> @@ -977,14 +1007,14 @@ instruction.</p> <table class="layout"> <tr class="layout"> <td class="left"> - <tt> < { int, int, int } > </tt><br/> - <tt> < { float, int (int) * } > </tt><br/> + <tt> < { i32, i32, i32 } > </tt><br/> + <tt> < { float, i32 (i32) * } > </tt><br/> </td> <td class="left"> - a triple of three <tt>int</tt> values<br/> + a triple of three <tt>i32</tt> values<br/> 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>int</tt>, returning an <tt>int</tt>.<br/> + that takes an <tt>i32</tt>, returning an <tt>i32</tt>.<br/> </td> </tr> </table> @@ -1002,15 +1032,15 @@ reference to another object, which must live in memory.</p> <table class="layout"> <tr class="layout"> <td class="left"> - <tt>[4x int]*</tt><br/> - <tt>int (int *) *</tt><br/> + <tt>[4x i32]*</tt><br/> + <tt>i32 (i32 *) *</tt><br/> </td> <td class="left"> A <a href="#t_pointer">pointer</a> to <a href="#t_array">array</a> of - four <tt>int</tt> values<br/> + four <tt>i32</tt> values<br/> A <a href="#t_pointer">pointer</a> to a <a - href="#t_function">function</a> that takes an <tt>int*</tt>, returning an - <tt>int</tt>.<br/> + href="#t_function">function</a> that takes an <tt>i32*</tt>, returning an + <tt>i32</tt>.<br/> </td> </tr> </table> @@ -1044,9 +1074,9 @@ be any integral or floating point type.</p> <table class="layout"> <tr class="layout"> <td class="left"> - <tt><4 x int></tt><br/> + <tt><4 x i32></tt><br/> <tt><8 x float></tt><br/> - <tt><2 x uint></tt><br/> + <tt><2 x i32></tt><br/> </td> <td class="left"> Packed vector of 4 integer values.<br/> @@ -1158,8 +1188,8 @@ and smaller aggregate constants.</p> <dd>Structure constants are represented with notation similar to structure type definitions (a comma separated list of elements, surrounded by braces - (<tt>{}</tt>)). For example: "<tt>{ int 4, float 17.0, int* %G }</tt>", - where "<tt>%G</tt>" is declared as "<tt>%G = external global int</tt>". Structure constants + (<tt>{}</tt>)). For example: "<tt>{ i32 4, float 17.0, i32* %G }</tt>", + where "<tt>%G</tt>" is declared as "<tt>%G = external global i32</tt>". Structure constants must have <a href="#t_struct">structure type</a>, and the number and types of elements must match those specified by the type. </dd> @@ -1168,7 +1198,7 @@ and smaller aggregate constants.</p> <dd>Array constants are represented with notation similar to array type definitions (a comma separated list of elements, surrounded by square brackets - (<tt>[]</tt>)). For example: "<tt>[ int 42, int 11, int 74 ]</tt>". Array + (<tt>[]</tt>)). For example: "<tt>[ i32 42, i32 11, i32 74 ]</tt>". Array constants must have <a href="#t_array">array type</a>, and the number and types of elements must match those specified by the type. </dd> @@ -1177,8 +1207,8 @@ and smaller aggregate constants.</p> <dd>Packed constants are represented with notation similar to packed type definitions (a comma separated list of elements, surrounded by - less-than/greater-than's (<tt><></tt>)). For example: "<tt>< int 42, - int 11, int 74, int 100 ></tt>". Packed constants must have <a + less-than/greater-than's (<tt><></tt>)). For example: "<tt>< i32 42, + i32 11, i32 74, i32 100 ></tt>". Packed constants must have <a href="#t_packed">packed type</a>, and the number and types of elements must match those specified by the type. </dd> @@ -1210,9 +1240,9 @@ href="#t_pointer">pointer</a> type. For example, the following is a legal LLVM file:</p> <pre> - %X = global int 17 - %Y = global int 42 - %Z = global [2 x int*] [ int* %X, int* %Y ] + %X = global i32 17 + %Y = global i32 42 + %Z = global [2 x i32*] [ i32* %X, i32* %Y ] </pre> </div> @@ -1368,7 +1398,7 @@ inline assembler expression is: </p> <pre> - int(int) asm "bswap $0", "=r,r" + i32 (i32) asm "bswap $0", "=r,r" </pre> <p> @@ -1377,7 +1407,7 @@ a <a href="#i_call"><tt>call</tt> instruction</a>. Thus, typically we have: </p> <pre> - %X = call int asm "<a href="#i_bswap">bswap</a> $0", "=r,r"(int %Y) + %X = call i32 asm "<a href="#i_bswap">bswap</a> $0", "=r,r"(i32 %Y) </pre> <p> @@ -1463,7 +1493,7 @@ at the beginning of the "normal" destination block. If the instruction returns a value, that value shall set the call or invoke instruction's return value.</p> <h5>Example:</h5> -<pre> ret int 5 <i>; Return an integer value of 5</i> +<pre> ret i32 5 <i>; Return an integer value of 5</i> ret void <i>; Return from a void function</i> </pre> </div> @@ -1489,8 +1519,8 @@ 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, int %a, %b<br> br bool %cond, label %IfEqual, label %IfUnequal<br>IfEqual:<br> <a - href="#i_ret">ret</a> int 1<br>IfUnequal:<br> <a href="#i_ret">ret</a> int 0<br></pre> +<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 + href="#i_ret">ret</a> i32 1<br>IfUnequal:<br> <a href="#i_ret">ret</a> i32 0<br></pre> </div> <!-- _______________________________________________________________________ --> <div class="doc_subsubsection"> @@ -1538,16 +1568,16 @@ branches or with a lookup table.</p> <pre> <i>; Emulate a conditional br instruction</i> - %Val = <a href="#i_zext">zext</a> bool %value to int - switch int %Val, label %truedest [int 0, label %falsedest ] + %Val = <a href="#i_zext">zext</a> bool %value to i32 + switch i32 %Val, label %truedest [i32 0, label %falsedest ] <i>; Emulate an unconditional br instruction</i> - switch uint 0, label %dest [ ] + switch i32 0, label %dest [ ] <i>; Implement a jump table:</i> - switch uint %val, label %otherwise [ uint 0, label %onzero - uint 1, label %onone - uint 2, label %ontwo ] + switch i32 %val, label %otherwise [ i32 0, label %onzero + i32 1, label %onone + i32 2, label %ontwo ] </pre> </div> @@ -1622,10 +1652,10 @@ exception. Additionally, this is important for implementation of <h5>Example:</h5> <pre> - %retval = invoke int %Test(int 15) to label %Continue - unwind label %TestCleanup <i>; {int}:retval set</i> - %retval = invoke <a href="#callingconv">coldcc</a> int %Test(int 15) to label %Continue - unwind label %TestCleanup <i>; {int}:retval set</i> + %retval = invoke i32 %Test(i32 15) to label %Continue + unwind label %TestCleanup <i>; {i32}:retval set</i> + %retval = invoke <a href="#callingconv">coldcc</a> i32 %Test(i32 15) to label %Continue + unwind label %TestCleanup <i>; {i32}:retval set</i> </pre> </div> @@ -1714,7 +1744,7 @@ Both arguments must have identical types.</p> <p>The value produced is the integer or floating point sum of the two operands.</p> <h5>Example:</h5> -<pre> <result> = add int 4, %var <i>; yields {int}:result = 4 + %var</i> +<pre> <result> = add i32 4, %var <i>; yields {i32}:result = 4 + %var</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -1739,8 +1769,8 @@ Both arguments must have identical types.</p> <p>The value produced is the integer or floating point difference of the two operands.</p> <h5>Example:</h5> -<pre> <result> = sub int 4, %var <i>; yields {int}:result = 4 - %var</i> - <result> = sub int 0, %val <i>; yields {int}:result = -%var</i> +<pre> <result> = sub i32 4, %var <i>; yields {i32}:result = 4 - %var</i> + <result> = sub i32 0, %val <i>; yields {i32}:result = -%var</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -1765,7 +1795,7 @@ two operands.</p> <p>There is no signed vs unsigned multiplication. The appropriate action is taken based on the type of the operand.</p> <h5>Example:</h5> -<pre> <result> = mul int 4, %var <i>; yields {int}:result = 4 * %var</i> +<pre> <result> = mul i32 4, %var <i>; yields {i32}:result = 4 * %var</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -1788,7 +1818,7 @@ of the values in which case the elements must be integers.</p> instruction always performs an unsigned division operation, regardless of whether the arguments are unsigned or not.</p> <h5>Example:</h5> -<pre> <result> = udiv uint 4, %var <i>; yields {uint}:result = 4 / %var</i> +<pre> <result> = udiv i32 4, %var <i>; yields {i32}:result = 4 / %var</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -1811,7 +1841,7 @@ of the values in which case the elements must be integers.</p> instruction always performs a signed division operation, regardless of whether the arguments are signed or not.</p> <h5>Example:</h5> -<pre> <result> = sdiv int 4, %var <i>; yields {int}:result = 4 / %var</i> +<pre> <result> = sdiv i32 4, %var <i>; yields {i32}:result = 4 / %var</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -1854,7 +1884,7 @@ types.</p> This instruction always performs an unsigned division to get the remainder, regardless of whether the arguments are unsigned or not.</p> <h5>Example:</h5> -<pre> <result> = urem uint 4, %var <i>; yields {uint}:result = 4 % %var</i> +<pre> <result> = urem i32 4, %var <i>; yields {i32}:result = 4 % %var</i> </pre> </div> @@ -1880,7 +1910,7 @@ information about the difference, see <a href="http://mathforum.org/dr.math/problems/anne.4.28.99.html">The Math Forum</a>.</p> <h5>Example:</h5> -<pre> <result> = srem int 4, %var <i>; yields {int}:result = 4 % %var</i> +<pre> <result> = srem i32 4, %var <i>; yields {i32}:result = 4 % %var</i> </pre> </div> @@ -1965,9 +1995,9 @@ identical types.</p> </table> </div> <h5>Example:</h5> -<pre> <result> = and int 4, %var <i>; yields {int}:result = 4 & %var</i> - <result> = and int 15, 40 <i>; yields {int}:result = 8</i> - <result> = and int 4, 8 <i>; yields {int}:result = 0</i> +<pre> <result> = and i32 4, %var <i>; yields {i32}:result = 4 & %var</i> + <result> = and i32 15, 40 <i>; yields {i32}:result = 8</i> + <result> = and i32 4, 8 <i>; yields {i32}:result = 0</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -2018,9 +2048,9 @@ identical types.</p> </table> </div> <h5>Example:</h5> -<pre> <result> = or int 4, %var <i>; yields {int}:result = 4 | %var</i> - <result> = or int 15, 40 <i>; yields {int}:result = 47</i> - <result> = or int 4, 8 <i>; yields {int}:result = 12</i> +<pre> <result> = or i32 4, %var <i>; yields {i32}:result = 4 | %var</i> + <result> = or i32 15, 40 <i>; yields {i32}:result = 47</i> + <result> = or i32 4, 8 <i>; yields {i32}:result = 12</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -2074,10 +2104,10 @@ identical types.</p> </div> <p> </p> <h5>Example:</h5> -<pre> <result> = xor int 4, %var <i>; yields {int}:result = 4 ^ %var</i> - <result> = xor int 15, 40 <i>; yields {int}:result = 39</i> - <result> = xor int 4, 8 <i>; yields {int}:result = 12</i> - <result> = xor int %V, -1 <i>; yields {int}:result = ~%V</i> +<pre> <result> = xor i32 4, %var <i>; yields {i32}:result = 4 ^ %var</i> + <result> = xor i32 15, 40 <i>; yields {i32}:result = 39</i> + <result> = xor i32 4, 8 <i>; yields {i32}:result = 12</i> + <result> = xor i32 %V, -1 <i>; yields {i32}:result = ~%V</i> </pre> </div> <!-- _______________________________________________________________________ --> @@ -2085,21 +2115,21 @@ identical types.</p> Instruction</a> </div> <div class="doc_text"> <h5>Syntax:</h5> -<pre> <result> = shl <ty> <var1>, ubyte <var2> <i>; yields {ty}:result</i> +<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>ubyte</tt>' + 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 int 4, ubyte %var <i>; yields {int}:result = 4 << %var</i> - <result> = shl int 4, ubyte 2 <i>; yields {int}:result = 16</i> - <result> = shl int 1, ubyte 10 <i>; yields {int}:result = 1024</i> +<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> <!-- _______________________________________________________________________ --> @@ -2107,7 +2137,7 @@ type.</p> Instruction</a> </div> <div class="doc_text"> <h5>Syntax:</h5> -<pre> <result> = lshr <ty> <var1>, ubyte <var2> <i>; yields {ty}:result</i> +<pre> <result> = lshr <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i> </pre> <h5>Overview:</h5> @@ -2116,7 +2146,7 @@ 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>ubyte</tt>' type.</p> + 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 @@ -2125,10 +2155,10 @@ bits will be filled with zero bits after the shift.</p> <h5>Example:</h5> <pre> - <result> = lshr uint 4, ubyte 1 <i>; yields {uint}:result = 2</i> - <result> = lshr int 4, ubyte 2 <i>; yields {uint}:result = 1</i> - <result> = lshr sbyte 4, ubyte 3 <i>; yields {sbyte}:result = 0</i> - <result> = lshr sbyte -2, ubyte 1 <i>; yields {sbyte}:result = 0x7FFFFFFF </i> + <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> @@ -2138,7 +2168,7 @@ Instruction</a> </div> <div class="doc_text"> <h5>Syntax:</h5> -<pre> <result> = ashr <ty> <var1>, ubyte <var2> <i>; yields {ty}:result</i> +<pre> <result> = ashr <ty> <var1>, i8 <var2> <i>; yields {ty}:result</i> </pre> <h5>Overview:</h5> @@ -2148,7 +2178,7 @@ 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>ubyte</tt>' type.</p> +'<tt>i8</tt>' type.</p> <h5>Semantics:</h5> <p>This instruction always performs an arithmetic shift right operation, @@ -2157,10 +2187,10 @@ significant bits will be filled with the sign bit of <tt>var1</tt>.</p> <h5>Example:</h5> <pre> - <result> = ashr uint 4, ubyte 1 <i>; yields {uint}:result = 2</i> - <result> = ashr int 4, ubyte 2 <i>; yields {int}:result = 1</i> - <result> = ashr ubyte 4, ubyte 3 <i>; yields {ubyte}:result = 0</i> - <result> = ashr sbyte -2, ubyte 1 <i>; yields {sbyte}:result = -1</i> + <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> @@ -2190,7 +2220,7 @@ target.</p> <h5>Syntax:</h5> <pre> - <result> = extractelement <n x <ty>> <val>, uint <idx> <i>; yields <ty></i> + <result> = extractelement <n x <ty>> <val>, i32 <idx> <i>; yields <ty></i> </pre> <h5>Overview:</h5> @@ -2221,7 +2251,7 @@ results are undefined. <h5>Example:</h5> <pre> - %result = extractelement <4 x int> %vec, uint 0 <i>; yields int</i> + %result = extractelement <4 x i32> %vec, i32 0 <i>; yields i32</i> </pre> </div> @@ -2236,7 +2266,7 @@ results are undefined. <h5>Syntax:</h5> <pre> - <result> = insertelement <n x <ty>> <val>, <ty> <elt>, uint <idx> <i>; yields <n x <ty>></i> + <result> = insertelement <n x <ty>> <val>, <ty> <elt>, i32 <idx> <i>; yields <n x <ty>></i> </pre> <h5>Overview:</h5> @@ -2268,7 +2298,7 @@ exceeds the length of <tt>val</tt>, the results are undefined. <h5>Example:</h5> <pre> - %result = insertelement <4 x int> %vec, int 1, uint 0 <i>; yields <4 x int></i> + %result = insertelement <4 x i32> %vec, i32 1, i32 0 <i>; yields <4 x i32></i> </pre> </div> @@ -2282,7 +2312,7 @@ exceeds the length of <tt>val</tt>, the results are undefined. <h5>Syntax:</h5> <pre> - <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <n x uint> <mask> <i>; yields <n x <ty>></i> + <result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <n x i32> <mask> <i>; |