1 ; RUN: llc < %s -emulated-tls -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel | FileCheck %s
4 @v = thread_local global i32 0
5 define i32 @f() nounwind {
13 ; CHECK: movl __emutls_v.v@GOT(%ebx), %eax
14 ; CHECK-NEXT: movl %eax, (%esp)
15 ; CHECK-NEXT: calll __emutls_get_address@PLT
16 ; CHECK-NEXT: movl (%eax), %eax
18 @alias = internal alias i32, i32* @v
19 define i32 @f_alias() nounwind {
21 %t = load i32, i32* @v
26 ; CHECK-LABEL: f_alias:
27 ; CHECK: movl __emutls_v.v@GOT(%ebx), %eax
28 ; CHECK-NEXT: movl %eax, (%esp)
29 ; CHECK-NEXT: calll __emutls_get_address@PLT
30 ; CHECK-NEXT: movl (%eax), %eax
32 ; Use my_emutls_get_address like __emutls_get_address.
33 @my_emutls_v_xyz = external global i8*, align 4
34 declare i8* @my_emutls_get_address(i8*)
36 define i32 @my_get_xyz() {
38 %call = call i8* @my_emutls_get_address(i8* bitcast (i8** @my_emutls_v_xyz to i8*))
39 %0 = bitcast i8* %call to i32*
40 %1 = load i32, i32* %0, align 4
44 ; CHECK-LABEL: my_get_xyz:
45 ; CHECK: movl my_emutls_v_xyz@GOT(%ebx), %eax
46 ; CHECK-NEXT: movl %eax, (%esp)
47 ; CHECK-NEXT: calll my_emutls_get_address@PLT
48 ; CHECK-NEXT: movl (%eax), %eax