• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -relocation-model=static -verify-machineinstrs < %s --enable-shrink-wrap=false -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s
3%struct.S = type { i8 }
4
5@sg = internal thread_local global %struct.S zeroinitializer, align 1
6@__dso_handle = external global i8
7@__tls_guard = internal thread_local unnamed_addr global i1 false
8@sum1 = internal thread_local global i32 0, align 4
9
10declare void @_ZN1SC1Ev(%struct.S*)
11declare void @_ZN1SD1Ev(%struct.S*)
12declare i32 @_tlv_atexit(void (i8*)*, i8*, i8*)
13
14define cxx_fast_tlscc nonnull %struct.S* @_ZTW2sg() nounwind {
15; CHECK-LABEL: _ZTW2sg:
16; CHECK:       # %bb.0:
17; CHECK-NEXT:    mflr 0
18; CHECK-NEXT:    std 30, -16(1) # 8-byte Folded Spill
19; CHECK-NEXT:    std 0, 16(1)
20; CHECK-NEXT:    stdu 1, -48(1)
21; CHECK-NEXT:    addis 3, 13, __tls_guard@tprel@ha
22; CHECK-NEXT:    lbz 4, __tls_guard@tprel@l(3)
23; CHECK-NEXT:    andi. 4, 4, 1
24; CHECK-NEXT:    bc 12, 1, .LBB0_2
25; CHECK-NEXT:  # %bb.1: # %init.i
26; CHECK-NEXT:    li 4, 1
27; CHECK-NEXT:    stb 4, __tls_guard@tprel@l(3)
28; CHECK-NEXT:    addis 3, 13, sg@tprel@ha
29; CHECK-NEXT:    addi 30, 3, sg@tprel@l
30; CHECK-NEXT:    mr 3, 30
31; CHECK-NEXT:    bl _ZN1SC1Ev
32; CHECK-NEXT:    nop
33; CHECK-NEXT:    addis 3, 2, .LC0@toc@ha
34; CHECK-NEXT:    addis 4, 2, .LC1@toc@ha
35; CHECK-NEXT:    ld 3, .LC0@toc@l(3)
36; CHECK-NEXT:    ld 5, .LC1@toc@l(4)
37; CHECK-NEXT:    mr 4, 30
38; CHECK-NEXT:    bl _tlv_atexit
39; CHECK-NEXT:    nop
40; CHECK-NEXT:  .LBB0_2: # %__tls_init.exit
41; CHECK-NEXT:    addis 3, 13, sg@tprel@ha
42; CHECK-NEXT:    addi 3, 3, sg@tprel@l
43; CHECK-NEXT:    addi 1, 1, 48
44; CHECK-NEXT:    ld 0, 16(1)
45; CHECK-NEXT:    ld 30, -16(1) # 8-byte Folded Reload
46; CHECK-NEXT:    mtlr 0
47; CHECK-NEXT:    blr
48  %.b.i = load i1, i1* @__tls_guard, align 1
49  br i1 %.b.i, label %__tls_init.exit, label %init.i
50
51init.i:
52  store i1 true, i1* @__tls_guard, align 1
53  tail call void @_ZN1SC1Ev(%struct.S* nonnull @sg) #2
54  %1 = tail call i32 @_tlv_atexit(void (i8*)* nonnull bitcast (void (%struct.S*)* @_ZN1SD1Ev to void (i8*)*), i8* nonnull getelementptr inbounds (%struct.S, %struct.S* @sg, i64 0, i32 0), i8* nonnull @__dso_handle) #2
55  br label %__tls_init.exit
56
57__tls_init.exit:
58  ret %struct.S* @sg
59}
60
61define cxx_fast_tlscc nonnull i32* @_ZTW4sum1() nounwind {
62; CHECK-LABEL: _ZTW4sum1:
63; CHECK:       # %bb.0:
64; CHECK-NEXT:    addis 3, 13, sum1@tprel@ha
65; CHECK-NEXT:    addi 3, 3, sum1@tprel@l
66; CHECK-NEXT:    blr
67  ret i32* @sum1
68}
69
70define cxx_fast_tlscc i32* @_ZTW4sum2() #0 {
71; CHECK-LABEL: _ZTW4sum2:
72; CHECK:       # %bb.0:
73; CHECK-NEXT:    addis 3, 13, sum1@tprel@ha
74; CHECK-NEXT:    addi 3, 3, sum1@tprel@l
75; CHECK-NEXT:    blr
76  ret i32* @sum1
77}
78
79attributes #0 = { nounwind "frame-pointer"="all" }
80