diff --git a/docs/LangRef.html b/docs/LangRef.html index be92ecc5d16..63c3da1331d 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -92,7 +92,8 @@
<result> = shr <ty> <var1>, ubyte <var2> ; yields {ty}:result +<result> = lshr <ty> <var1>, ubyte <var2> ; yields {ty}:result+Overview:
-The 'shr' instruction returns the first operand shifted to -the right a specified number of bits.
+The 'lshr' instruction (logical shift right) returns the first +operand shifted to the right a specified number of bits.
+Arguments:
-The first argument to the 'shr' instruction must be an integer type. The second argument must be an 'ubyte' -type.
+The first argument to the 'lshr' instruction must be an integer type. The second argument must be an 'ubyte' type.
+Semantics:
-If the first argument is a signed 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.
+This instruction always performs a logical shift right operation, regardless +of whether the arguments are unsigned or not. The var2 most significant +bits will be filled with zero bits after the shift.
+Example:
-<result> = shr int 4, ubyte %var ; yields {int}:result = 4 >> %var - <result> = shr uint 4, ubyte 1 ; yields {uint}:result = 2 - <result> = shr int 4, ubyte 2 ; yields {int}:result = 1 - <result> = shr sbyte 4, ubyte 3 ; yields {sbyte}:result = 0 - <result> = shr sbyte -2, ubyte 1 ; yields {sbyte}:result = -1 ++ <result> = lshr uint 4, ubyte 1 ; yields {uint}:result = 2 + <result> = lshr int 4, ubyte 2 ; yields {uint}:result = 1 + <result> = lshr sbyte 4, ubyte 3 ; yields {sbyte}:result = 0 + <result> = lshr sbyte -2, ubyte 1 ; yields {sbyte}:result = 0x7FFFFFFF ++
<result> = ashr <ty> <var1>, ubyte <var2> ; yields {ty}:result ++ +
The 'ashr' instruction (arithmetic shift right) returns the first +operand shifted to the right a specified number of bits.
+ +The first argument to the 'ashr' instruction must be an +integer type. The second argument must be an +'ubyte' type.
+ +This instruction always performs an arithmetic shift right operation, +regardless of whether the arguments are signed or not. The var2 most +significant bits will be filled with the sign bit of var1.
+ ++ <result> = ashr uint 4, ubyte 1 ; yields {uint}:result = 2 + <result> = ashr int 4, ubyte 2 ; yields {int}:result = 1 + <result> = ashr ubyte 4, ubyte 3 ; yields {ubyte}:result = 0 + <result> = ashr sbyte -2, ubyte 1 ; yields {sbyte}:result = -1