diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/gcc~13/sh-built-in-functions.html | |
new repository
Diffstat (limited to 'devdocs/gcc~13/sh-built-in-functions.html')
| -rw-r--r-- | devdocs/gcc~13/sh-built-in-functions.html | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/devdocs/gcc~13/sh-built-in-functions.html b/devdocs/gcc~13/sh-built-in-functions.html new file mode 100644 index 00000000..2edd1462 --- /dev/null +++ b/devdocs/gcc~13/sh-built-in-functions.html @@ -0,0 +1,31 @@ +<div class="subsection-level-extent" id="SH-Built-in-Functions"> <div class="nav-panel"> <p> Next: <a href="sparc-vis-built-in-functions" accesskey="n" rel="next">SPARC VIS Built-in Functions</a>, Previous: <a href="s_002f390-system-z-built-in-functions" accesskey="p" rel="prev">S/390 System z Built-in Functions</a>, Up: <a href="target-builtins" accesskey="u" rel="up">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="subsection" id="SH-Built-in-Functions-1"><span>6.60.32 SH Built-in Functions<a class="copiable-link" href="#SH-Built-in-Functions-1"> ¶</a></span></h1> <p>The following built-in functions are supported on the SH1, SH2, SH3 and SH4 families of processors: </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fset_005fthread_005fpointer"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_set_thread_pointer</strong> <code class="def-code-arguments">(void *<var class="var">ptr</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fset_005fthread_005fpointer"> ¶</a></span> +</dt> <dd> +<p>Sets the ‘<samp class="samp">GBR</samp>’ register to the specified value <var class="var">ptr</var>. This is usually used by system code that manages threads and execution contexts. The compiler normally does not generate code that modifies the contents of ‘<samp class="samp">GBR</samp>’ and thus the value is preserved across function calls. Changing the ‘<samp class="samp">GBR</samp>’ value in user code must be done with caution, since the compiler might use ‘<samp class="samp">GBR</samp>’ in order to access thread local variables. </p> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fthread_005fpointer-1"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void *</code> <strong class="def-name">__builtin_thread_pointer</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fthread_005fpointer-1"> ¶</a></span> +</dt> <dd> +<p>Returns the value that is currently set in the ‘<samp class="samp">GBR</samp>’ register. Memory loads and stores that use the thread pointer as a base address are turned into ‘<samp class="samp">GBR</samp>’ based displacement loads and stores, if possible. For example: </p> +<div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">struct my_tcb +{ + int a, b, c, d, e; +}; + +int get_tcb_value (void) +{ + // Generate ‘<samp class="samp">mov.l @(8,gbr),r0</samp>’ instruction + return ((my_tcb*)__builtin_thread_pointer ())->c; +}</pre> +</div> </dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsh_005fget_005ffpscr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">__builtin_sh_get_fpscr</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsh_005fget_005ffpscr"> ¶</a></span> +</dt> <dd><p>Returns the value that is currently set in the ‘<samp class="samp">FPSCR</samp>’ register. </p></dd> +</dl> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fbuiltin_005fsh_005fset_005ffpscr"> +<span class="category-def">Built-in Function: </span><span><code class="def-type">void</code> <strong class="def-name">__builtin_sh_set_fpscr</strong> <code class="def-code-arguments">(unsigned int <var class="var">val</var>)</code><a class="copiable-link" href="#index-_005f_005fbuiltin_005fsh_005fset_005ffpscr"> ¶</a></span> +</dt> <dd><p>Sets the ‘<samp class="samp">FPSCR</samp>’ register to the specified value <var class="var">val</var>, while preserving the current values of the FR, SZ and PR bits. </p></dd> +</dl> </div> <div class="nav-panel"> <p> Next: <a href="sparc-vis-built-in-functions">SPARC VIS Built-in Functions</a>, Previous: <a href="s_002f390-system-z-built-in-functions">S/390 System z Built-in Functions</a>, Up: <a href="target-builtins">Built-in Functions Specific to Particular Target Machines</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution"> + <p class="_attribution-p"> + © Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br> + <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Built-in-Functions.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/SH-Built-in-Functions.html</a> + </p> +</div> |
