From cbb38f2f67a3c775b546230ea244e6b003749bde Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 20 Jul 2009 22:41:19 +0000 Subject: Documentation for the new non-overflow and exact keywords. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76495 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/LangRef.html b/docs/LangRef.html index dced11c441..334cb68772 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -2600,7 +2600,9 @@ Instruction
Syntax:
-  <result> = add <ty> <op1>, <op2>   ; yields {ty}:result
+  <result> = add <ty> <op1>, <op2>          ; yields {ty}:result
+  <result> = signed add <ty> <op1>, <op2>   ; yields {ty}:result
+  <result> = unsigned add <ty> <op1>, <op2> ; yields {ty}:result
 
Overview:
@@ -2620,6 +2622,10 @@ Instruction

Because LLVM integers use a two's complement representation, this instruction is appropriate for both signed and unsigned integers.

+

If the signed and/or unsigned keywords are present, + the behavior of the add is undefined if signed and/or unsigned + overflow, respectively, occurs.

+
Example:
   <result> = add i32 4, %var          ; yields {i32}:result = 4 + %var
@@ -2666,7 +2672,9 @@ Instruction 
 
 
Syntax:
-  <result> = sub <ty> <op1>, <op2>   ; yields {ty}:result
+  <result> = sub <ty> <op1>, <op2>            ; yields {ty}:result
+  <result> = signed sub <ty> <op1>, <op2>     ; yields {ty}:result
+  <result> = unsigned sub <ty> <op1>, <op2>   ; yields {ty}:result
 
Overview:
@@ -2692,6 +2700,10 @@ Instruction

Because LLVM integers use a two's complement representation, this instruction is appropriate for both signed and unsigned integers.

+

If the signed and/or unsigned keywords are present, + the behavior of the sub is undefined if signed and/or unsigned + overflow, respectively, occurs.

+
Example:
   <result> = sub i32 4, %var          ; yields {i32}:result = 4 - %var
@@ -2745,7 +2757,9 @@ Instruction 
 
 
Syntax:
-  <result> = mul <ty> <op1>, <op2>   ; yields {ty}:result
+  <result> = mul <ty> <op1>, <op2>            ; yields {ty}:result
+  <result> = signed mul <ty> <op1>, <op2>     ; yields {ty}:result
+  <result> = unsigned mul <ty> <op1>, <op2>   ; yields {ty}:result
 
Overview:
@@ -2770,6 +2784,10 @@ Instruction be sign-extended or zero-extended as appropriate to the width of the full product.

+

If the signed and/or unsigned keywords are present, + the behavior of the mul is undefined if signed and/or unsigned + overflow, respectively, occurs.

+
Example:
   <result> = mul i32 4, %var          ; yields {i32}:result = 4 * %var
@@ -2849,7 +2867,8 @@ Instruction 
 
 
Syntax:
-  <result> = sdiv <ty> <op1>, <op2>   ; yields {ty}:result
+  <result> = sdiv <ty> <op1>, <op2>         ; yields {ty}:result
+  <result> = exact sdiv <ty> <op1>, <op2>   ; yields {ty}:result
 
Overview:
@@ -2871,6 +2890,9 @@ Instruction undefined behavior; this is a rare case, but can occur, for example, by doing a 32-bit division of -2147483648 by -1.

+

If the exact keyword is present, the result of the sdiv + is undefined if the result would be rounded or if overflow occurs.

+
Example:
   <result> = sdiv i32 4, %var          ; yields {i32}:result = 4 / %var
@@ -3912,13 +3934,6 @@ entry:
   }
 
-

Note that it is undefined to access an array out of bounds: array and pointer - indexes must always be within the defined bounds of the array type when - accessed with an instruction that dereferences the pointer (e.g. a load or - store instruction). The one exception for this rule is zero length arrays. - These arrays are defined to be accessible as variable length arrays, which - requires access beyond the zero'th element.

-

The getelementptr instruction is often confusing. For some more insight into how it works, see the getelementptr FAQ.

-- cgit v1.2.3