diff options
Diffstat (limited to 'docs/LangRef.html')
-rw-r--r-- | docs/LangRef.html | 69 |
1 files changed, 52 insertions, 17 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html index be92ecc5d1..63c3da1331 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -92,7 +92,8 @@ <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_shr">'<tt>shr</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> </ol> </li> <li><a href="#vectorops">Vector Operations</a> @@ -2070,30 +2071,64 @@ type.</p> </pre> </div> <!-- _______________________________________________________________________ --> -<div class="doc_subsubsection"> <a name="i_shr">'<tt>shr</tt>' +<div class="doc_subsubsection"> <a name="i_lshr">'<tt>lshr</tt>' Instruction</a> </div> <div class="doc_text"> <h5>Syntax:</h5> -<pre> <result> = shr <ty> <var1>, ubyte <var2> <i>; yields {ty}:result</i> +<pre> <result> = lshr <ty> <var1>, ubyte <var2> <i>; yields {ty}:result</i> </pre> + <h5>Overview:</h5> -<p>The '<tt>shr</tt>' instruction returns the first operand shifted to -the right a specified number of bits.</p> +<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>shr</tt>' instruction must be an <a - href="#t_integer">integer</a> type. The second argument must be an '<tt>ubyte</tt>' -type.</p> +<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> + <h5>Semantics:</h5> -<p>If the first argument is a <a href="#t_signed">signed</a> type, the -most significant bit is duplicated in the newly free'd bit positions. -If the first argument is unsigned, zero bits shall fill the empty -positions.</p> +<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> = shr int 4, ubyte %var <i>; yields {int}:result = 4 >> %var</i> - <result> = shr uint 4, ubyte 1 <i>; yields {uint}:result = 2</i> - <result> = shr int 4, ubyte 2 <i>; yields {int}:result = 1</i> - <result> = shr sbyte 4, ubyte 3 <i>; yields {sbyte}:result = 0</i> - <result> = shr sbyte -2, ubyte 1 <i>; yields {sbyte}:result = -1</i> +<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> +</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>, ubyte <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>ubyte</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 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> </pre> </div> |