int test00 (void* p, int x) { int* tcb = (int*)__builtin_thread_pointer (); int r = tcb[4]; __builtin_set_thread_pointer (p); tcb = (int*)__builtin_thread_pointer (); return tcb[255] + r; }
void test02 (int* x, int a, int b) { int* tcb = (int*)__builtin_thread_pointer (); tcb[50] = a; __builtin_set_thread_pointer (x); tcb = (int*)__builtin_thread_pointer (); tcb[40] = b; }
int test04 (const int* x, int c, int** xx, int d) { int s = 0; int i; for (i = 0; i < c; ++i) { volatile int* tcb = (volatile int*)__builtin_thread_pointer (); tcb[20] = s; __builtin_set_thread_pointer (xx[i]); tcb = (volatile int*)__builtin_thread_pointer (); s ^= x[i] + tcb[40] + d; } return s; }
int test01 (int x) { /* We must see a stc gbr,rn before the function call, because a function call could modify the gbr. In this case the user requests the old gbr value, before the function call. */ int* p = (int*)__builtin_thread_pointer (); p[5] = test00 (); return 0; }
int test_01 (int x, volatile int* y, int a) { if (a) test_00 (); y[0] = 1; tcb_t* tcb = (tcb_t*)__builtin_thread_pointer (); return (a & 5) ? tcb->x : tcb->w; }
int test03 (const int* x, int c) { volatile int* tcb = (volatile int*)__builtin_thread_pointer (); int s = 0; int i; for (i = 0; i < c; ++i) s ^= x[i] + tcb[40]; return s; }
void *f0() { return __builtin_thread_pointer(); }
int test_00 (int a, tcb_t* b, int c) { tcb_t* tcb = (tcb_t*)__builtin_thread_pointer (); return (a & 5) ? tcb->x : tcb->w; }
int test_00 (int a, tcb_t* b) { tcb_t* tcb = (a & 5) ? (tcb_t*)__builtin_thread_pointer () : b; return tcb->w + tcb->x; }
void* test00 (void) { return __builtin_thread_pointer (); }
void *tp (void) { return __builtin_thread_pointer (); // CHECK: call {{.*}} @llvm.thread.pointer() }
int test01 (void) { unsigned short* tcb = (unsigned short*)__builtin_thread_pointer (); return tcb[500]; }