xref: /aosp_15_r20/external/llvm/test/CodeGen/Mips/tls-models.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mipsel -relocation-model=pic < %s | FileCheck -check-prefix=CHECK-PIC %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=mipsel -relocation-model=static < %s | FileCheck -check-prefix=CHECK-NONPIC %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@external_gd = external thread_local global i32
5*9880d681SAndroid Build Coastguard Worker@internal_gd = internal thread_local global i32 42
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker@external_ld = external thread_local(localdynamic) global i32
8*9880d681SAndroid Build Coastguard Worker@internal_ld = internal thread_local(localdynamic) global i32 42
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker@external_ie = external thread_local(initialexec) global i32
11*9880d681SAndroid Build Coastguard Worker@internal_ie = internal thread_local(initialexec) global i32 42
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker@external_le = external thread_local(localexec) global i32
14*9880d681SAndroid Build Coastguard Worker@internal_le = internal thread_local(localexec) global i32 42
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; ----- no model specified -----
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdefine i32* @f1() {
19*9880d681SAndroid Build Coastguard Workerentry:
20*9880d681SAndroid Build Coastguard Worker  ret i32* @external_gd
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker  ; Non-PIC code can use initial-exec, PIC code has to use general dynamic.
23*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f1:
24*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %gottprel
25*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f1:
26*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %tlsgd
27*9880d681SAndroid Build Coastguard Worker}
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdefine i32* @f2() {
30*9880d681SAndroid Build Coastguard Workerentry:
31*9880d681SAndroid Build Coastguard Worker  ret i32* @internal_gd
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker  ; Non-PIC code can use local exec, PIC code can use local dynamic.
34*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f2:
35*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %tprel_hi
36*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f2:
37*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %tlsldm
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker; ----- localdynamic specified -----
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerdefine i32* @f3() {
44*9880d681SAndroid Build Coastguard Workerentry:
45*9880d681SAndroid Build Coastguard Worker  ret i32* @external_ld
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Worker  ; Non-PIC code can use initial exec, PIC should use local dynamic.
48*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f3:
49*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %gottprel
50*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f3:
51*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %tlsldm
52*9880d681SAndroid Build Coastguard Worker}
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerdefine i32* @f4() {
55*9880d681SAndroid Build Coastguard Workerentry:
56*9880d681SAndroid Build Coastguard Worker  ret i32* @internal_ld
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker  ; Non-PIC code can use local exec, PIC code can use local dynamic.
59*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f4:
60*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %tprel_hi
61*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f4:
62*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %tlsldm
63*9880d681SAndroid Build Coastguard Worker}
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Worker; ----- initialexec specified -----
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard Workerdefine i32* @f5() {
69*9880d681SAndroid Build Coastguard Workerentry:
70*9880d681SAndroid Build Coastguard Worker  ret i32* @external_ie
71*9880d681SAndroid Build Coastguard Worker
72*9880d681SAndroid Build Coastguard Worker  ; Non-PIC and PIC code will use initial exec as specified.
73*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f5:
74*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %gottprel
75*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f5:
76*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %gottprel
77*9880d681SAndroid Build Coastguard Worker}
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Workerdefine i32* @f6() {
80*9880d681SAndroid Build Coastguard Workerentry:
81*9880d681SAndroid Build Coastguard Worker  ret i32* @internal_ie
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Worker  ; Non-PIC code can use local exec, PIC code use initial exec as specified.
84*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f6:
85*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %tprel_hi
86*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f6:
87*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %gottprel
88*9880d681SAndroid Build Coastguard Worker}
89*9880d681SAndroid Build Coastguard Worker
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard Worker; ----- localexec specified -----
92*9880d681SAndroid Build Coastguard Worker
93*9880d681SAndroid Build Coastguard Workerdefine i32* @f7() {
94*9880d681SAndroid Build Coastguard Workerentry:
95*9880d681SAndroid Build Coastguard Worker  ret i32* @external_le
96*9880d681SAndroid Build Coastguard Worker
97*9880d681SAndroid Build Coastguard Worker  ; Non-PIC and PIC code will use local exec as specified.
98*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f7:
99*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %tprel_hi
100*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f7:
101*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %tprel_hi
102*9880d681SAndroid Build Coastguard Worker}
103*9880d681SAndroid Build Coastguard Worker
104*9880d681SAndroid Build Coastguard Workerdefine i32* @f8() {
105*9880d681SAndroid Build Coastguard Workerentry:
106*9880d681SAndroid Build Coastguard Worker  ret i32* @internal_le
107*9880d681SAndroid Build Coastguard Worker
108*9880d681SAndroid Build Coastguard Worker  ; Non-PIC and PIC code will use local exec as specified.
109*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC-LABEL:   f8:
110*9880d681SAndroid Build Coastguard Worker  ; CHECK-NONPIC:   %tprel_hi
111*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC-LABEL:      f8:
112*9880d681SAndroid Build Coastguard Worker  ; CHECK-PIC:      %tprel_hi
113*9880d681SAndroid Build Coastguard Worker}
114