<pre class="doc_code">
<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 i8]</a> c"hello world\0A\00" <i>; [13 x i8]*</i>
+<a href="#identifiers">@.LC0</a> = <a href="#linkage_internal">internal</a> <a 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> i32 @puts(i8*) <i>; i32 (i8*)* </i>
<h5>Syntax:</h5>
<pre>
- <result> = udiv <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = udiv <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = udiv exact <ty> <op1>, <op2> <i>; yields {ty}:result</i>
</pre>
<h5>Overview:</h5>
<p>Division by zero leads to undefined behavior.</p>
+<p>If the <tt>exact</tt> keyword is present, the result value of the
+ <tt>udiv</tt> is a <a href="#trapvalues">trap value</a> if %op1 is not a
+ multiple of %op2 (as such, "((a udiv exact b) mul b) == a").</p>
+
+
<h5>Example:</h5>
<pre>
<result> = udiv i32 4, %var <i>; yields {i32}:result = 4 / %var</i>
<h5>Syntax:</h5>
<pre>
- <result> = shl <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = shl <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = shl nuw <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = shl nsw <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = shl nuw nsw <ty> <op1>, <op2> <i>; yields {ty}:result</i>
</pre>
<h5>Overview:</h5>
vectors, each vector element of <tt>op1</tt> is shifted by the corresponding
shift amount in <tt>op2</tt>.</p>
+<p>If the <tt>nuw</tt> keyword is present, then the shift produces a
+ <a href="#trapvalues">trap value</a> if it shifts out any non-zero bits. If
+ the <tt>nsw</tt> keywrod is present, then the shift produces a
+ <a href="#trapvalues">trap value</a> if it shifts out any bits that disagree
+ with the resultant sign bit. As such, NUW/NSW have the same semantics as
+ they would if the shift were expressed as a mul instruction with the same
+ nsw/nuw bits in (mul %op1, (shl 1, %op2)).</p>
+
<h5>Example:</h5>
<pre>
<result> = shl i32 4, %var <i>; yields {i32}: 4 << %var</i>
<h5>Syntax:</h5>
<pre>
- <result> = lshr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = lshr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = lshr exact <ty> <op1>, <op2> <i>; yields {ty}:result</i>
</pre>
<h5>Overview:</h5>
vectors, each vector element of <tt>op1</tt> is shifted by the corresponding
shift amount in <tt>op2</tt>.</p>
+<p>If the <tt>exact</tt> keyword is present, the result value of the
+ <tt>lshr</tt> is a <a href="#trapvalues">trap value</a> if any of the bits
+ shifted out are non-zero.</p>
+
+
<h5>Example:</h5>
<pre>
<result> = lshr i32 4, 1 <i>; yields {i32}:result = 2</i>
<h5>Syntax:</h5>
<pre>
- <result> = ashr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = ashr <ty> <op1>, <op2> <i>; yields {ty}:result</i>
+ <result> = ashr exact <ty> <op1>, <op2> <i>; yields {ty}:result</i>
</pre>
<h5>Overview:</h5>
the arguments are vectors, each vector element of <tt>op1</tt> is shifted by
the corresponding shift amount in <tt>op2</tt>.</p>
+<p>If the <tt>exact</tt> keyword is present, the result value of the
+ <tt>ashr</tt> is a <a href="#trapvalues">trap value</a> if any of the bits
+ shifted out are non-zero.</p>
+
<h5>Example:</h5>
<pre>
<result> = ashr i32 4, 1 <i>; yields {i32}:result = 2</i>