gcc: SH Built-in Functions
1
1 6.59.27 SH Built-in Functions
1 -----------------------------
1
1 The following built-in functions are supported on the SH1, SH2, SH3 and
1 SH4 families of processors:
1
1 -- Built-in Function: void __builtin_set_thread_pointer (void *PTR)
1 Sets the 'GBR' register to the specified value PTR. This is
1 usually used by system code that manages threads and execution
1 contexts. The compiler normally does not generate code that
1 modifies the contents of 'GBR' and thus the value is preserved
1 across function calls. Changing the 'GBR' value in user code must
1 be done with caution, since the compiler might use 'GBR' in order
1 to access thread local variables.
1
1 -- Built-in Function: void * __builtin_thread_pointer (void)
1 Returns the value that is currently set in the 'GBR' register.
1 Memory loads and stores that use the thread pointer as a base
1 address are turned into 'GBR' based displacement loads and stores,
1 if possible. For example:
1 struct my_tcb
1 {
1 int a, b, c, d, e;
1 };
1
1 int get_tcb_value (void)
1 {
1 // Generate 'mov.l @(8,gbr),r0' instruction
1 return ((my_tcb*)__builtin_thread_pointer ())->c;
1 }
1
1
1 -- Built-in Function: unsigned int __builtin_sh_get_fpscr (void)
1 Returns the value that is currently set in the 'FPSCR' register.
1
1 -- Built-in Function: void __builtin_sh_set_fpscr (unsigned int VAL)
1 Sets the 'FPSCR' register to the specified value VAL, while
1 preserving the current values of the FR, SZ and PR bits.
1