From 48b0bbf930f9efa72f46f70b7e81dec69c2397cc Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 12 Dec 2011 04:36:04 +0000 Subject: [PATCH] Update the LangRef documentation for llvm.ctlz and llvm.cttz to specify the behavior with the newly added flag for undefined results on a zero input. I'm terrible at documentation, so comments and suggestions welcome here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146361 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 60 +++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index 2d77ca48ee3..b4751e8189e 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -7335,12 +7335,12 @@ LLVM.

targets support all bit widths or vector types, however.

-  declare i8 @llvm.ctlz.i8 (i8  <src>)
-  declare i16 @llvm.ctlz.i16(i16 <src>)
-  declare i32 @llvm.ctlz.i32(i32 <src>)
-  declare i64 @llvm.ctlz.i64(i64 <src>)
-  declare i256 @llvm.ctlz.i256(i256 <src>)
-  declare <2 x i32> @llvm.ctlz.v2i32(<2 x i32> <src;gt)
+  declare i8   @llvm.ctlz.i8  (i8   <src>, i1 <is_zero_undef>)
+  declare i16  @llvm.ctlz.i16 (i16  <src>, i1 <is_zero_undef>)
+  declare i32  @llvm.ctlz.i32 (i32  <src>, i1 <is_zero_undef>)
+  declare i64  @llvm.ctlz.i64 (i64  <src>, i1 <is_zero_undef>)
+  declare i256 @llvm.ctlz.i256(i256 <src>, i1 <is_zero_undef>)
+  declase <2 x i32> @llvm.ctlz.v2i32(<2 x i32> <src>, i1 <is_zero_undef>)
 
Overview:
@@ -7348,15 +7348,22 @@ LLVM.

leading zeros in a variable.

Arguments:
-

The only argument is the value to be counted. The argument may be of any - integer type, or any vector type with integer element type. - The return type must match the argument type.

+

The first argument is the value to be counted. This argument may be of any + integer type, or a vectory with integer element type. The return type + must match the first argument type.

+ +

The second argument must be a constant and is a flag to indicate whether the + intrinsic should ensure that a zero as the first argument produces a defined + result. Historically some architectures did not provide a defined result for + zero values as efficiently, and many algorithms are now predicated on + avoiding zero-value inputs.

Semantics:

The 'llvm.ctlz' intrinsic counts the leading (most significant) - zeros in a variable, or within each element of the vector if the operation - is of vector type. If the src == 0 then the result is the size in bits of - the type of src. For example, llvm.ctlz(i32 2) = 30.

+ zeros in a variable, or within each element of the vector. + If src == 0 then the result is the size in bits of the type of + src if is_zero_undef == 0 and undef otherwise. + For example, llvm.ctlz(i32 2) = 30.

@@ -7373,12 +7380,12 @@ LLVM.

support all bit widths or vector types, however.

-  declare i8 @llvm.cttz.i8 (i8  <src>)
-  declare i16 @llvm.cttz.i16(i16 <src>)
-  declare i32 @llvm.cttz.i32(i32 <src>)
-  declare i64 @llvm.cttz.i64(i64 <src>)
-  declare i256 @llvm.cttz.i256(i256 <src>)
-  declase <2 x i32> @llvm.cttz.v2i32(<2 x i32> <src>)
+  declare i8   @llvm.cttz.i8  (i8   <src>, i1 <is_zero_undef>)
+  declare i16  @llvm.cttz.i16 (i16  <src>, i1 <is_zero_undef>)
+  declare i32  @llvm.cttz.i32 (i32  <src>, i1 <is_zero_undef>)
+  declare i64  @llvm.cttz.i64 (i64  <src>, i1 <is_zero_undef>)
+  declare i256 @llvm.cttz.i256(i256 <src>, i1 <is_zero_undef>)
+  declase <2 x i32> @llvm.cttz.v2i32(<2 x i32> <src>, i1 <is_zero_undef>)
 
Overview:
@@ -7386,15 +7393,22 @@ LLVM.

trailing zeros.

Arguments:
-

The only argument is the value to be counted. The argument may be of any - integer type, or a vectory with integer element type.. The return type - must match the argument type.

+

The first argument is the value to be counted. This argument may be of any + integer type, or a vectory with integer element type. The return type + must match the first argument type.

+ +

The second argument must be a constant and is a flag to indicate whether the + intrinsic should ensure that a zero as the first argument produces a defined + result. Historically some architectures did not provide a defined result for + zero values as efficiently, and many algorithms are now predicated on + avoiding zero-value inputs.

Semantics:

The 'llvm.cttz' intrinsic counts the trailing (least significant) zeros in a variable, or within each element of a vector. - If the src == 0 then the result is the size in bits of - the type of src. For example, llvm.cttz(2) = 1.

+ If src == 0 then the result is the size in bits of the type of + src if is_zero_undef == 0 and undef otherwise. + For example, llvm.cttz(2) = 1.

-- 2.34.1