Merging r261039:
[oota-llvm.git] / test / CodeGen / X86 / darwin-tls.ll
1 ; RUN: llc < %s -mtriple x86_64-apple-darwin | FileCheck %s
2
3 @a = thread_local global i32 4, align 4
4
5 define i32 @f2(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5) {
6 entry:
7 ; Parameters are in %edi, %esi, %edx, %ecx, %r8d, there is no need to save
8 ; these parameters except the one in %edi, before making the TLS call.
9 ; %edi is used to pass parameter to the TLS call.
10 ; CHECK-NOT: movl %r8d
11 ; CHECK-NOT: movl %ecx
12 ; CHECK-NOT: movl %edx
13 ; CHECK-NOT: movl %esi
14 ; CHECK: movq {{.*}}TLVP{{.*}}, %rdi
15 ; CHECK-NEXT: callq
16 ; CHECK-NEXT: movl (%rax),
17 ; CHECK-NOT: movl {{.*}}, %esi
18 ; CHECK-NOT: movl {{.*}}, %edx
19 ; CHECK-NOT: movl {{.*}}, %ecx
20 ; CHECK-NOT: movl {{.*}}, %r8d
21 ; CHECK: callq
22   %0 = load i32, i32* @a, align 4
23   %call = tail call i32 @f3(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5)
24   %add = add nsw i32 %call, %0
25   ret i32 %add
26 }
27
28 declare i32 @f3(i32, i32, i32, i32, i32)