1 ; RUN: llc < %s -mtriple x86_64-apple-darwin -mcpu=core2 | FileCheck %s 2 3 %struct.A = type { [48 x i8], i32, i32, i32 } 4 5 @c = external thread_local global %struct.A, align 4 6 7 define void @main() nounwind ssp { 8 ; CHECK-LABEL: main: 9 entry: 10 call void @llvm.memset.p0i8.i64(i8* getelementptr inbounds (%struct.A, %struct.A* @c, i32 0, i32 0, i32 0), i8 0, i64 60, i32 1, i1 false) 11 unreachable 12 ; CHECK: movq _c@TLVP(%rip), %rdi 13 ; CHECK-NEXT: callq *(%rdi) 14 ; CHECK-NEXT: movl $0, 56(%rax) 15 ; CHECK-NEXT: movq $0, 48(%rax) 16 } 17 18 ; rdar://10291355 19 define i32 @test() nounwind readonly ssp { 20 entry: 21 ; CHECK-LABEL: test: 22 ; CHECK: movq _a@TLVP(%rip), 23 ; CHECK: callq * 24 ; CHECK: movl (%rax), [[REGISTER:%[a-z]+]] 25 ; CHECK: movq _b@TLVP(%rip), 26 ; CHECK: callq * 27 ; CHECK: subl (%rax), [[REGISTER]] 28 %0 = load i32, i32* @a, align 4 29 %1 = load i32, i32* @b, align 4 30 %sub = sub nsw i32 %0, %1 31 ret i32 %sub 32 } 33 34 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind 35 36 @a = thread_local global i32 0 ; <i32*> [#uses=0] 37 @b = thread_local global i32 0 ; <i32*> [#uses=0] 38 39 ; CHECK: .tbss _a$tlv$init, 4, 2 40 ; CHECK: .section __DATA,__thread_vars,thread_local_variables 41 ; CHECK: .globl _a 42 ; CHECK: _a: 43 ; CHECK: .quad __tlv_bootstrap 44 ; CHECK: .quad 0 45 ; CHECK: .quad _a$tlv$init 46 47 ; CHECK: .tbss _b$tlv$init, 4, 2 48 ; CHECK: .globl _b 49 ; CHECK: _b: 50 ; CHECK: .quad __tlv_bootstrap 51 ; CHECK: .quad 0 52 ; CHECK: .quad _b$tlv$init 53