[llvm-commits] CVS: llvm/docs/LangRef.html

Reid Spencer reid at x10sys.com
Sun Apr 1 01:04:52 PDT 2007



Changes in directory llvm/docs:

LangRef.html updated: 1.219 -> 1.220
---
Log message:

For PR1297: http://llvm.org/PR1297 :
Document changes to bswap and bit counting intrinsics. bswap's name now
requires two types in the suffix per overloaded intrinsic naming rules.
The ctpop, cttz, and ctlz intrinsics were changed to always return i32.


---
Diffs of the changes:  (+50 -25)

 LangRef.html |   75 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 50 insertions(+), 25 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.219 llvm/docs/LangRef.html:1.220
--- llvm/docs/LangRef.html:1.219	Fri Mar 30 11:09:58 2007
+++ llvm/docs/LangRef.html	Sun Apr  1 03:04:23 2007
@@ -3580,10 +3580,10 @@
 <div class="doc_text">
 
 <p>LLVM supports the notion of an "intrinsic function".  These functions have
-well known names and semantics and are required to follow certain
-restrictions. Overall, these instructions represent an extension mechanism for
-the LLVM language that does not require changing all of the transformations in
-LLVM to add to the language (or the bytecode reader/writer, the parser,
+well known names and semantics and are required to follow certain restrictions.
+Overall, these intrinsics represent an extension mechanism for the LLVM 
+language that does not require changing all of the transformations in LLVM to 
+add to the language (or the bytecode reader/writer, the parser,
 etc...).</p>
 
 <p>Intrinsic function names must all start with an "<tt>llvm.</tt>" prefix. This
@@ -3594,9 +3594,20 @@
 function.  Additionally, because intrinsic functions are part of the LLVM
 language, it is required that they all be documented here if any are added.</p>
 
+<p>Some intrinsic functions can be overloaded. That is, the intrinsic represents
+a family of functions that perform the same operation but on different data
+types. This is most frequent with the integer types. Since LLVM can represent
+over 8 million different integer types, there is a way to declare an intrinsic 
+that can be overloaded based on its arguments. Such intrinsics will have the
+names of the arbitrary types encoded into the intrinsic function name, each
+preceded by a period. For example, the <tt>llvm.ctpop</tt> function can take an
+integer of any width. This leads to a family of functions such as 
+<tt>i32 @llvm.ctpop.i8(i8 %val)</tt> and <tt>i32 @llvm.ctpop.i29(i29 %val)</tt>.
+</p>
+
 
-<p>To learn how to add an intrinsic function, please see the <a
-href="ExtendingLLVM.html">Extending LLVM Guide</a>.
+<p>To learn how to add an intrinsic function, please see the 
+<a href="ExtendingLLVM.html">Extending LLVM Guide</a>.
 </p>
 
 </div>
@@ -4421,29 +4432,34 @@
 <div class="doc_text">
 
 <h5>Syntax:</h5>
+<p>This is an overloaded intrinsic function. You can use bswap on any integer
+type that is an even number of bytes (i.e. BitWidth % 16 == 0). Note the suffix
+that includes the type for the result and the operand.
 <pre>
-  declare i16 @llvm.bswap.i16(i16 <id>)
-  declare i32 @llvm.bswap.i32(i32 <id>)
-  declare i64 @llvm.bswap.i64(i64 <id>)
+  declare i16 @llvm.bswap.i16.i16(i16 <id>)
+  declare i32 @llvm.bswap.i32.i32(i32 <id>)
+  declare i64 @llvm.bswap.i64.i32(i64 <id>)
 </pre>
 
 <h5>Overview:</h5>
 
 <p>
-The '<tt>llvm.bwsap</tt>' family of intrinsics is used to byteswap a 16, 32 or
-64 bit quantity.  These are useful for performing operations on data that is not
-in the target's  native byte order.
+The '<tt>llvm.bwsap</tt>' family of intrinsics is used to byteswap integer 
+values with an even number of bytes (positive multiple of 16 bits).  These are 
+useful for performing operations on data that is not in the target's native 
+byte order.
 </p>
 
 <h5>Semantics:</h5>
 
 <p>
-The <tt>llvm.bswap.16</tt> intrinsic returns an i16 value that has the high 
+The <tt>llvm.bswap.16.i16</tt> intrinsic returns an i16 value that has the high 
 and low byte of the input i16 swapped.  Similarly, the <tt>llvm.bswap.i32</tt> 
 intrinsic returns an i32 value that has the four bytes of the input i32 
 swapped, so that if the input bytes are numbered 0, 1, 2, 3 then the returned 
-i32 will have its bytes in 3, 2, 1, 0 order.  The <tt>llvm.bswap.i64</tt> 
-intrinsic extends this concept to 64 bits.
+i32 will have its bytes in 3, 2, 1, 0 order.  The <tt>llvm.bswap.i48.i48</tt>, 
+<tt>llvm.bswap.i64.i64</tt> and other intrinsics extend this concept to
+additional even-byte lengths (6 bytes, 8 bytes and more, respectively).
 </p>
 
 </div>
@@ -4456,11 +4472,14 @@
 <div class="doc_text">
 
 <h5>Syntax:</h5>
+<p>This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit
+width. Not all targets support all bit widths however.
 <pre>
-  declare i8  @llvm.ctpop.i8 (i8  <src>)
-  declare i16 @llvm.ctpop.i16(i16 <src>)
+  declare i32 @llvm.ctpop.i8 (i8  <src>)
+  declare i32 @llvm.ctpop.i16(i16 <src>)
   declare i32 @llvm.ctpop.i32(i32 <src>)
-  declare i64 @llvm.ctpop.i64(i64 <src>)
+  declare i32 @llvm.ctpop.i64(i64 <src>)
+  declare i32 @llvm.ctpop.i256(i256 <src>)
 </pre>
 
 <h5>Overview:</h5>
@@ -4492,11 +4511,14 @@
 <div class="doc_text">
 
 <h5>Syntax:</h5>
+<p>This is an overloaded intrinsic. You can use <tt>llvm.ctlz</tt> on any 
+integer bit width. Not all targets support all bit widths however.
 <pre>
-  declare i8  @llvm.ctlz.i8 (i8  <src>)
-  declare i16 @llvm.ctlz.i16(i16 <src>)
+  declare i32 @llvm.ctlz.i8 (i8  <src>)
+  declare i32 @llvm.ctlz.i16(i16 <src>)
   declare i32 @llvm.ctlz.i32(i32 <src>)
-  declare i64 @llvm.ctlz.i64(i64 <src>)
+  declare i32 @llvm.ctlz.i64(i64 <src>)
+  declare i32 @llvm.ctlz.i256(i256 <src>)
 </pre>
 
 <h5>Overview:</h5>
@@ -4532,11 +4554,14 @@
 <div class="doc_text">
 
 <h5>Syntax:</h5>
+<p>This is an overloaded intrinsic. You can use <tt>llvm.cttz</tt> on any 
+integer bit width. Not all targets support all bit widths however.
 <pre>
-  declare i8  @llvm.cttz.i8 (i8  <src>)
-  declare i16 @llvm.cttz.i16(i16 <src>)
+  declare i32 @llvm.cttz.i8 (i8  <src>)
+  declare i32 @llvm.cttz.i16(i16 <src>)
   declare i32 @llvm.cttz.i32(i32 <src>)
-  declare i64 @llvm.cttz.i64(i64 <src>)
+  declare i32 @llvm.cttz.i64(i64 <src>)
+  declare i32 @llvm.cttz.i256(i256 <src>)
 </pre>
 
 <h5>Overview:</h5>
@@ -4600,7 +4625,7 @@
 
   <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
   <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2007/03/30 16:09:58 $
+  Last modified: $Date: 2007/04/01 08:04:23 $
 </address>
 </body>
 </html>






More information about the llvm-commits mailing list