re PR target/54760 ([SH] Add __builtin_thread_pointer, __builtin_set_thread_pointer)

PR target/54760
	* doc/extend.texi (Target Builtins): Add SH built-in section.
	Document __builtin_thread_pointer and __builtin_set_thread_pointer.

From-SVN: r192269
This commit is contained in:
Oleg Endo 2012-10-09 18:59:11 +00:00
parent 3cedb9108b
commit be06a8b00a
2 changed files with 42 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2012-10-09 Oleg Endo <olegendo@gcc.gnu.org>
PR target/54760
* doc/extend.texi (Target Builtins): Add SH built-in section.
Document __builtin_thread_pointer and __builtin_set_thread_pointer.
2012-10-09 Venkataramanan Kumar <venkataramanan.kumar@amd.com>
PR middle-end/53397

View File

@ -8651,6 +8651,7 @@ instructions, but allow the compiler to schedule those calls.
* PowerPC Built-in Functions::
* PowerPC AltiVec/VSX Built-in Functions::
* RX Built-in Functions::
* SH Built-in Functions::
* SPARC VIS Built-in Functions::
* SPU Built-in Functions::
* TI C6X Built-in Functions::
@ -13687,6 +13688,41 @@ if the VSX instruction set is available. The @samp{vec_vsx_ld} and
@samp{vec_vsx_st} builtins will always generate the VSX @samp{LXVD2X},
@samp{LXVW4X}, @samp{STXVD2X}, and @samp{STXVW4X} instructions.
@node SH Built-in Functions
@subsection SH Built-in Functions
The following built-in functions are supported on the SH1, SH2, SH3 and SH4
families of processors:
@deftypefn {Built-in Function} {void} __builtin_set_thread_pointer (void *@var{ptr})
Sets the @samp{GBR} register to the specified value @var{ptr}. This is usually
used by system code that manages threads and execution contexts. The compiler
normally will not generate code that modifies the contents of @samp{GBR} and
thus the value is preserved across function calls. Changing the @samp{GBR}
value in user code must be done with caution, since the compiler might use
@samp{GBR} in order to access thread local variables.
@end deftypefn
@deftypefn {Built-in Function} {void *} __builtin_thread_pointer (void)
Returns the value that is currently set in the @samp{GBR} register.
Memory loads and stores that use the thread pointer as a base address will be
turned into @samp{GBR} based displacement loads and stores, if possible.
For example:
@smallexample
struct my_tcb
@{
int a, b, c, d, e;
@};
int get_tcb_value (void)
@{
// Generate @samp{mov.l @@(8,gbr),r0} instruction
return ((my_tcb*)__builtin_thread_pointer ())->c;
@}
@end smallexample
@end deftypefn
@node RX Built-in Functions
@subsection RX Built-in Functions
GCC supports some of the RX instructions which cannot be expressed in