diff options
author | Hal Finkel <hfinkel@anl.gov> | 2012-08-05 22:03:08 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2012-08-05 22:03:08 +0000 |
commit | a841c19f7860393d6319bf40e9d662284462771d (patch) | |
tree | 1bdb535e6e2bca630e09dc14fa2fb554d9522a99 /docs/LanguageExtensions.html | |
parent | 65263b4ec184212155c92740ab0bd363bb85c49e (diff) |
Add __builtin_readcyclecounter() to produce the @llvm.readcyclecounter() intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LanguageExtensions.html')
-rw-r--r-- | docs/LanguageExtensions.html | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html index 0b99263bba..eac3c69997 100644 --- a/docs/LanguageExtensions.html +++ b/docs/LanguageExtensions.html @@ -98,6 +98,7 @@ <li><a href="#complex-list-init">Initializer lists for complex numbers in C</a></li> <li><a href="#builtins">Builtin Functions</a> <ul> + <li><a href="#__builtin_readcyclecounter">__builtin_readcyclecounter</a></li> <li><a href="#__builtin_shufflevector">__builtin_shufflevector</a></li> <li><a href="#__builtin_unreachable">__builtin_unreachable</a></li> <li><a href="#__sync_swap">__sync_swap</a></li> @@ -1367,6 +1368,42 @@ vector support</a> instead of builtins, in order to reduce the number of builtins that we need to implement.</p> <!-- ======================================================================= --> +<h3><a name="__builtin_readcyclecounter">__builtin_readcyclecounter</a></h3> +<!-- ======================================================================= --> + +<p><tt>__builtin_readcyclecounter</tt> is used to access the cycle counter +register (or a similar low-latency, high-accuracy clock) on those targets that +support it. +</p> + +<p><b>Syntax:</b></p> + +<pre> +__builtin_readcyclecounter() +</pre> + +<p><b>Example of Use:</b></p> + +<pre> +unsigned long long t0 = __builtin_readcyclecounter(); +do_something(); +unsigned long long t1 = __builtin_readcyclecounter(); +unsigned long long cycles_to_do_something = t1 - t0; // assuming no overflow +</pre> + +<p><b>Description:</b></p> + +<p>The __builtin_readcyclecounter() builtin returns the cycle counter value, +which may be either global or process/thread-specific depending on the target. +As the backing counters often overflow quickly (on the order of +seconds) this should only be used for timing small intervals. When not +supported by the target, the return value is always zero. This builtin +takes no arguments and produces an unsigned long long result. +</p> + +<p>Query for this feature with __has_builtin(__builtin_readcyclecounter).</p> + +<!-- ======================================================================= --> <h3><a name="__builtin_shufflevector">__builtin_shufflevector</a></h3> <!-- ======================================================================= --> |