1 # RUN: llc -march=mips64 -target-abi n64 -start-before=finalize-isel \
2 # RUN: -stop-after=finalize-isel -relocation-model=pic -mattr=+xgot \
5 # A simple test to show that we can parse the target specific flags: gpoff-hi,
6 # gpoff-lo, tlsgd, tlsldm, dtprel-hi, dtprel-lo, got-hi, got-lo, call-hi,
10 @v = global i32 0, align 4
11 @k = thread_local global i32 0, align 4
12 @j = external thread_local global i32, align 4
13 @__tls_guard = internal thread_local global i1 false, align 1
14 declare extern_weak void @_ZTH1j()
16 declare i32 @_Z1gi(i32 signext)
18 define i32 @_Z2k1i(i32 signext %asd) {
20 %call = tail call i32 @_Z1gi(i32 signext %asd)
21 %add = add nsw i32 %call, %asd
22 %0 = load i32, ptr @v, align 4
23 %add1 = add nsw i32 %add, %0
24 %.b.i.i = load i1, ptr @__tls_guard, align 1
25 br i1 %.b.i.i, label %entry._ZTW1k.exit_crit_edge, label %init.i.i
27 entry._ZTW1k.exit_crit_edge:
28 %.pre = load i32, ptr @k, align 4
32 store i1 true, ptr @__tls_guard, align 1
33 %call.i.i.i = tail call i32 @_Z1gi(i32 signext 3)
34 store i32 %call.i.i.i, ptr @k, align 4
38 %1 = phi i32 [ %.pre, %entry._ZTW1k.exit_crit_edge ], [ %call.i.i.i, %init.i.i ]
39 %add2 = add nsw i32 %add1, %1
40 %cmp = icmp ne ptr @_ZTH1j, null
41 br i1 %cmp, label %2, label %_ZTW1j.exit
44 tail call void @_ZTH1j()
48 %3 = load i32, ptr @j, align 4
49 %add3 = add nsw i32 %add2, %3
56 exposesReturnsTwice: false
58 regBankSelected: false
60 tracksRegLiveness: true
62 - { id: 0, class: gpr32, preferred-register: '' }
63 - { id: 1, class: gpr32, preferred-register: '' }
64 - { id: 2, class: gpr32, preferred-register: '' }
65 - { id: 3, class: gpr32, preferred-register: '' }
66 - { id: 4, class: gpr32, preferred-register: '' }
67 - { id: 5, class: gpr64, preferred-register: '' }
68 - { id: 6, class: gpr64, preferred-register: '' }
69 - { id: 7, class: gpr64, preferred-register: '' }
70 - { id: 8, class: gpr64, preferred-register: '' }
71 - { id: 9, class: gpr64, preferred-register: '' }
72 - { id: 10, class: gpr32, preferred-register: '' }
73 - { id: 11, class: gpr32, preferred-register: '' }
74 - { id: 12, class: gpr32, preferred-register: '' }
75 - { id: 13, class: gpr64, preferred-register: '' }
76 - { id: 14, class: gpr64, preferred-register: '' }
77 - { id: 15, class: gpr64, preferred-register: '' }
78 - { id: 16, class: gpr32, preferred-register: '' }
79 - { id: 17, class: gpr64, preferred-register: '' }
80 - { id: 18, class: gpr64, preferred-register: '' }
81 - { id: 19, class: gpr64, preferred-register: '' }
82 - { id: 20, class: gpr64, preferred-register: '' }
83 - { id: 21, class: gpr64, preferred-register: '' }
84 - { id: 22, class: gpr64, preferred-register: '' }
85 - { id: 23, class: gpr32, preferred-register: '' }
86 - { id: 24, class: gpr64, preferred-register: '' }
87 - { id: 25, class: gpr64, preferred-register: '' }
88 - { id: 26, class: gpr64, preferred-register: '' }
89 - { id: 27, class: gpr64, preferred-register: '' }
90 - { id: 28, class: gpr64, preferred-register: '' }
91 - { id: 29, class: gpr64, preferred-register: '' }
92 - { id: 30, class: gpr32, preferred-register: '' }
93 - { id: 31, class: gpr64, preferred-register: '' }
94 - { id: 32, class: gpr64, preferred-register: '' }
95 - { id: 33, class: gpr64, preferred-register: '' }
96 - { id: 34, class: gpr64, preferred-register: '' }
97 - { id: 35, class: gpr32, preferred-register: '' }
98 - { id: 36, class: gpr64, preferred-register: '' }
99 - { id: 37, class: gpr64, preferred-register: '' }
100 - { id: 38, class: gpr64, preferred-register: '' }
101 - { id: 39, class: gpr64, preferred-register: '' }
102 - { id: 40, class: gpr64, preferred-register: '' }
103 - { id: 41, class: gpr64, preferred-register: '' }
104 - { id: 42, class: gpr64, preferred-register: '' }
105 - { id: 43, class: gpr64, preferred-register: '' }
106 - { id: 44, class: gpr64, preferred-register: '' }
107 - { id: 45, class: gpr64, preferred-register: '' }
108 - { id: 46, class: gpr64, preferred-register: '' }
109 - { id: 47, class: gpr64, preferred-register: '' }
110 - { id: 48, class: gpr64, preferred-register: '' }
111 - { id: 49, class: gpr64, preferred-register: '' }
112 - { id: 50, class: gpr64, preferred-register: '' }
113 - { id: 51, class: gpr64, preferred-register: '' }
114 - { id: 52, class: gpr64, preferred-register: '' }
115 - { id: 53, class: gpr64, preferred-register: '' }
116 - { id: 54, class: gpr64, preferred-register: '' }
117 - { id: 55, class: gpr32, preferred-register: '' }
118 - { id: 56, class: gpr32, preferred-register: '' }
119 - { id: 57, class: gpr64, preferred-register: '' }
120 - { id: 58, class: gpr64, preferred-register: '' }
122 - { reg: '$a0_64', virtual-reg: '%5' }
123 - { reg: '$t9_64', virtual-reg: '' }
125 isFrameAddressTaken: false
126 isReturnAddressTaken: false
135 maxCallFrameSize: 4294967295
136 hasOpaqueSPAdjustment: false
138 hasMustTailInVarArgFunc: false
146 successors: %bb.1.entry._ZTW1k.exit_crit_edge(0x7fe00000), %bb.2.init.i.i(0x00200000)
147 liveins: $a0_64, $t9_64
149 %57 = LUi64 target-flags(mips-gpoff-hi) @_Z2k1i
150 %58 = DADDu %57, $t9_64
151 %6 = DADDiu %58, target-flags(mips-gpoff-lo) @_Z2k1i
153 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
154 %7 = LUi64 target-flags(mips-call-hi16) @_Z1gi
155 %8 = DADDu killed %7, %6
156 %9 = LD killed %8, target-flags(mips-call-lo16) @_Z1gi :: (load (s64) from call-entry @_Z1gi)
159 JALR64Pseudo killed %9, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0
160 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
163 %12 = ADDu %10, killed %11
164 %13 = LUi64 target-flags(mips-got-hi16) @v
165 %14 = DADDu killed %13, %6
166 %15 = LD killed %14, target-flags(mips-got-lo16) @v :: (load (s64) from got)
167 %16 = LW killed %15, 0 :: (dereferenceable load (s32) from @v)
168 %0 = ADDu killed %12, killed %16
169 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
170 %17 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
171 %18 = DADDu killed %17, %6
172 %19 = LD killed %18, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
173 %20 = DADDiu %6, target-flags(mips-tlsldm) @__tls_guard
176 JALR64Pseudo killed %19, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
177 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
179 %22 = DADDiu %21, target-flags(mips-dtprel-hi) @__tls_guard
180 %23 = LBu killed %22, target-flags(mips-dtprel-lo) @__tls_guard :: (dereferenceable load (s8) from @__tls_guard)
181 BEQ killed %23, $zero, %bb.2.init.i.i, implicit-def dead $at
182 B %bb.1.entry._ZTW1k.exit_crit_edge, implicit-def dead $at
184 bb.1.entry._ZTW1k.exit_crit_edge:
185 successors: %bb.3._ZTW1k.exit(0x80000000)
187 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
188 %39 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
189 %40 = DADDu killed %39, %6
190 %41 = LD killed %40, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
191 %42 = DADDiu %6, target-flags(mips-tlsgd) @k
194 JALR64Pseudo killed %41, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
195 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
197 %1 = LW %43, 0 :: (dereferenceable load (s32) from @k)
198 B %bb.3._ZTW1k.exit, implicit-def dead $at
201 successors: %bb.3._ZTW1k.exit(0x80000000)
203 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
204 %24 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
205 %25 = DADDu killed %24, %6
206 %26 = LD %25, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
207 %27 = DADDiu %6, target-flags(mips-tlsldm) @__tls_guard
210 JALR64Pseudo killed %26, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
211 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
213 %29 = DADDiu %28, target-flags(mips-dtprel-hi) @__tls_guard
215 SB killed %30, killed %29, target-flags(mips-dtprel-lo) @__tls_guard :: (store (s8) into @__tls_guard)
216 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
217 %31 = LUi64 target-flags(mips-call-hi16) @_Z1gi
218 %32 = DADDu killed %31, %6
219 %33 = DADDiu $zero_64, 3
220 %34 = LD killed %32, target-flags(mips-call-lo16) @_Z1gi :: (load (s64) from call-entry @_Z1gi)
223 JALR64Pseudo killed %34, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0
224 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
226 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
227 %36 = LD %25, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
228 %37 = DADDiu %6, target-flags(mips-tlsgd) @k
231 JALR64Pseudo killed %36, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
232 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
234 SW %35, %38, 0 :: (store (s32) into @k)
238 successors: %bb.4(0x40000000), %bb.5._ZTW1j.exit(0x40000000)
240 %3 = PHI %2, %bb.2.init.i.i, %1, %bb.1.entry._ZTW1k.exit_crit_edge
242 %44 = LUi64 target-flags(mips-got-hi16) @_ZTH1j
243 %45 = DADDu killed %44, %6
244 %46 = LD killed %45, target-flags(mips-got-lo16) @_ZTH1j :: (load (s64) from got)
245 BEQ64 killed %46, $zero_64, %bb.5._ZTW1j.exit, implicit-def dead $at
246 B %bb.4, implicit-def dead $at
249 successors: %bb.5._ZTW1j.exit(0x80000000)
251 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
252 %47 = LUi64 target-flags(mips-call-hi16) @_ZTH1j
253 %48 = DADDu killed %47, %6
254 %49 = LD killed %48, target-flags(mips-call-lo16) @_ZTH1j :: (load (s64) from call-entry @_ZTH1j)
256 JALR64Pseudo killed %49, csr_n64, implicit-def dead $ra, implicit $gp_64, implicit-def $sp
257 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
260 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
261 %50 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
262 %51 = DADDu killed %50, %6
263 %52 = LD killed %51, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
264 %53 = DADDiu %6, target-flags(mips-tlsgd) @j
267 JALR64Pseudo killed %52, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
268 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
270 %55 = LW %54, 0 :: (dereferenceable load (s32) from @j)
271 %56 = ADDu %4, killed %55