1 ; RUN: llc < %s -emulated-tls -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel | FileCheck %s
2 ; RUN: llc < %s -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel \
3 ; RUN: | FileCheck -check-prefix=NoEMU %s
8 @v = thread_local global i32 0
9 define i32 @f() nounwind {
11 %t = load i32, i32* @v
17 ; CHECK: movl __emutls_v.v@GOT(%ebx), %eax
18 ; CHECK-NEXT: movl %eax, (%esp)
19 ; CHECK-NEXT: calll __emutls_get_address@PLT
20 ; CHECK-NEXT: movl (%eax), %eax
22 @alias = internal alias i32, i32* @v
23 define i32 @f_alias() nounwind {
25 %t = load i32, i32* @v
30 ; CHECK-LABEL: f_alias:
31 ; CHECK: movl __emutls_v.v@GOT(%ebx), %eax
32 ; CHECK-NEXT: movl %eax, (%esp)
33 ; CHECK-NEXT: calll __emutls_get_address@PLT
34 ; CHECK-NEXT: movl (%eax), %eax
36 ; Use my_emutls_get_address like __emutls_get_address.
37 @my_emutls_v_xyz = external global i8*, align 4
38 declare i8* @my_emutls_get_address(i8*)
40 define i32 @my_get_xyz() {
42 %call = call i8* @my_emutls_get_address(i8* bitcast (i8** @my_emutls_v_xyz to i8*))
43 %0 = bitcast i8* %call to i32*
44 %1 = load i32, i32* %0, align 4
48 ; CHECK-LABEL: my_get_xyz:
49 ; CHECK: movl my_emutls_v_xyz@GOT(%ebx), %eax
50 ; CHECK-NEXT: movl %eax, (%esp)
51 ; CHECK-NEXT: calll my_emutls_get_address@PLT
52 ; CHECK-NEXT: movl (%eax), %eax