[TwoAddressInstructionPass] When looking for a 3 addr conversion after commuting...
[oota-llvm.git] / test / CodeGen / X86 / fast-isel-emutls.ll
1 ; RUN: llc < %s -emulated-tls -march=x86 -relocation-model=pic -mtriple=i686-unknown-linux-gnu -fast-isel | FileCheck %s
2 ; PR3654
3
4 @v = thread_local global i32 0
5 define i32 @f() nounwind {
6 entry:
7           %t = load i32, i32* @v
8           %s = add i32 %t, 1
9           ret i32 %s
10 }
11
12 ; CHECK-LABEL: f:
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
17
18 @alias = internal alias i32, i32* @v
19 define i32 @f_alias() nounwind {
20 entry:
21           %t = load i32, i32* @v
22           %s = add i32 %t, 1
23           ret i32 %s
24 }
25
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
31
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*)
35
36 define i32 @my_get_xyz() {
37 entry:
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
41   ret i32 %1
42 }
43
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