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 br i1 icmp ne (ptr @_ZTH1j, ptr null), label %2, label %_ZTW1j.exit
43 tail call void @_ZTH1j()
47 %3 = load i32, ptr @j, align 4
48 %add3 = add nsw i32 %add2, %3
55 exposesReturnsTwice: false
57 regBankSelected: false
59 tracksRegLiveness: true
61 - { id: 0, class: gpr32, preferred-register: '' }
62 - { id: 1, class: gpr32, preferred-register: '' }
63 - { id: 2, class: gpr32, preferred-register: '' }
64 - { id: 3, class: gpr32, preferred-register: '' }
65 - { id: 4, class: gpr32, preferred-register: '' }
66 - { id: 5, class: gpr64, preferred-register: '' }
67 - { id: 6, class: gpr64, preferred-register: '' }
68 - { id: 7, class: gpr64, preferred-register: '' }
69 - { id: 8, class: gpr64, preferred-register: '' }
70 - { id: 9, class: gpr64, preferred-register: '' }
71 - { id: 10, class: gpr32, preferred-register: '' }
72 - { id: 11, class: gpr32, preferred-register: '' }
73 - { id: 12, class: gpr32, preferred-register: '' }
74 - { id: 13, class: gpr64, preferred-register: '' }
75 - { id: 14, class: gpr64, preferred-register: '' }
76 - { id: 15, class: gpr64, preferred-register: '' }
77 - { id: 16, class: gpr32, preferred-register: '' }
78 - { id: 17, class: gpr64, preferred-register: '' }
79 - { id: 18, class: gpr64, preferred-register: '' }
80 - { id: 19, class: gpr64, preferred-register: '' }
81 - { id: 20, class: gpr64, preferred-register: '' }
82 - { id: 21, class: gpr64, preferred-register: '' }
83 - { id: 22, class: gpr64, preferred-register: '' }
84 - { id: 23, class: gpr32, preferred-register: '' }
85 - { id: 24, class: gpr64, preferred-register: '' }
86 - { id: 25, class: gpr64, preferred-register: '' }
87 - { id: 26, class: gpr64, preferred-register: '' }
88 - { id: 27, class: gpr64, preferred-register: '' }
89 - { id: 28, class: gpr64, preferred-register: '' }
90 - { id: 29, class: gpr64, preferred-register: '' }
91 - { id: 30, class: gpr32, preferred-register: '' }
92 - { id: 31, class: gpr64, preferred-register: '' }
93 - { id: 32, class: gpr64, preferred-register: '' }
94 - { id: 33, class: gpr64, preferred-register: '' }
95 - { id: 34, class: gpr64, preferred-register: '' }
96 - { id: 35, class: gpr32, preferred-register: '' }
97 - { id: 36, class: gpr64, preferred-register: '' }
98 - { id: 37, class: gpr64, preferred-register: '' }
99 - { id: 38, class: gpr64, preferred-register: '' }
100 - { id: 39, class: gpr64, preferred-register: '' }
101 - { id: 40, class: gpr64, preferred-register: '' }
102 - { id: 41, class: gpr64, preferred-register: '' }
103 - { id: 42, class: gpr64, preferred-register: '' }
104 - { id: 43, class: gpr64, preferred-register: '' }
105 - { id: 44, class: gpr64, preferred-register: '' }
106 - { id: 45, class: gpr64, preferred-register: '' }
107 - { id: 46, class: gpr64, preferred-register: '' }
108 - { id: 47, class: gpr64, preferred-register: '' }
109 - { id: 48, class: gpr64, preferred-register: '' }
110 - { id: 49, class: gpr64, preferred-register: '' }
111 - { id: 50, class: gpr64, preferred-register: '' }
112 - { id: 51, class: gpr64, preferred-register: '' }
113 - { id: 52, class: gpr64, preferred-register: '' }
114 - { id: 53, class: gpr64, preferred-register: '' }
115 - { id: 54, class: gpr64, preferred-register: '' }
116 - { id: 55, class: gpr32, preferred-register: '' }
117 - { id: 56, class: gpr32, preferred-register: '' }
118 - { id: 57, class: gpr64, preferred-register: '' }
119 - { id: 58, class: gpr64, preferred-register: '' }
121 - { reg: '$a0_64', virtual-reg: '%5' }
122 - { reg: '$t9_64', virtual-reg: '' }
124 isFrameAddressTaken: false
125 isReturnAddressTaken: false
134 maxCallFrameSize: 4294967295
135 hasOpaqueSPAdjustment: false
137 hasMustTailInVarArgFunc: false
145 successors: %bb.1.entry._ZTW1k.exit_crit_edge(0x7fe00000), %bb.2.init.i.i(0x00200000)
146 liveins: $a0_64, $t9_64
148 %57 = LUi64 target-flags(mips-gpoff-hi) @_Z2k1i
149 %58 = DADDu %57, $t9_64
150 %6 = DADDiu %58, target-flags(mips-gpoff-lo) @_Z2k1i
152 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
153 %7 = LUi64 target-flags(mips-call-hi16) @_Z1gi
154 %8 = DADDu killed %7, %6
155 %9 = LD killed %8, target-flags(mips-call-lo16) @_Z1gi :: (load (s64) from call-entry @_Z1gi)
158 JALR64Pseudo killed %9, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0
159 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
162 %12 = ADDu %10, killed %11
163 %13 = LUi64 target-flags(mips-got-hi16) @v
164 %14 = DADDu killed %13, %6
165 %15 = LD killed %14, target-flags(mips-got-lo16) @v :: (load (s64) from got)
166 %16 = LW killed %15, 0 :: (dereferenceable load (s32) from @v)
167 %0 = ADDu killed %12, killed %16
168 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
169 %17 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
170 %18 = DADDu killed %17, %6
171 %19 = LD killed %18, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
172 %20 = DADDiu %6, target-flags(mips-tlsldm) @__tls_guard
175 JALR64Pseudo killed %19, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
176 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
178 %22 = DADDiu %21, target-flags(mips-dtprel-hi) @__tls_guard
179 %23 = LBu killed %22, target-flags(mips-dtprel-lo) @__tls_guard :: (dereferenceable load (s8) from @__tls_guard)
180 BEQ killed %23, $zero, %bb.2.init.i.i, implicit-def dead $at
181 B %bb.1.entry._ZTW1k.exit_crit_edge, implicit-def dead $at
183 bb.1.entry._ZTW1k.exit_crit_edge:
184 successors: %bb.3._ZTW1k.exit(0x80000000)
186 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
187 %39 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
188 %40 = DADDu killed %39, %6
189 %41 = LD killed %40, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
190 %42 = DADDiu %6, target-flags(mips-tlsgd) @k
193 JALR64Pseudo killed %41, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
194 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
196 %1 = LW %43, 0 :: (dereferenceable load (s32) from @k)
197 B %bb.3._ZTW1k.exit, implicit-def dead $at
200 successors: %bb.3._ZTW1k.exit(0x80000000)
202 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
203 %24 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
204 %25 = DADDu killed %24, %6
205 %26 = LD %25, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
206 %27 = DADDiu %6, target-flags(mips-tlsldm) @__tls_guard
209 JALR64Pseudo killed %26, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
210 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
212 %29 = DADDiu %28, target-flags(mips-dtprel-hi) @__tls_guard
214 SB killed %30, killed %29, target-flags(mips-dtprel-lo) @__tls_guard :: (store (s8) into @__tls_guard)
215 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
216 %31 = LUi64 target-flags(mips-call-hi16) @_Z1gi
217 %32 = DADDu killed %31, %6
218 %33 = DADDiu $zero_64, 3
219 %34 = LD killed %32, target-flags(mips-call-lo16) @_Z1gi :: (load (s64) from call-entry @_Z1gi)
222 JALR64Pseudo killed %34, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0
223 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
225 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
226 %36 = LD %25, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
227 %37 = DADDiu %6, target-flags(mips-tlsgd) @k
230 JALR64Pseudo killed %36, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
231 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
233 SW %35, %38, 0 :: (store (s32) into @k)
237 successors: %bb.4(0x40000000), %bb.5._ZTW1j.exit(0x40000000)
239 %3 = PHI %2, %bb.2.init.i.i, %1, %bb.1.entry._ZTW1k.exit_crit_edge
241 %44 = LUi64 target-flags(mips-got-hi16) @_ZTH1j
242 %45 = DADDu killed %44, %6
243 %46 = LD killed %45, target-flags(mips-got-lo16) @_ZTH1j :: (load (s64) from got)
244 BEQ64 killed %46, $zero_64, %bb.5._ZTW1j.exit, implicit-def dead $at
245 B %bb.4, implicit-def dead $at
248 successors: %bb.5._ZTW1j.exit(0x80000000)
250 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
251 %47 = LUi64 target-flags(mips-call-hi16) @_ZTH1j
252 %48 = DADDu killed %47, %6
253 %49 = LD killed %48, target-flags(mips-call-lo16) @_ZTH1j :: (load (s64) from call-entry @_ZTH1j)
255 JALR64Pseudo killed %49, csr_n64, implicit-def dead $ra, implicit $gp_64, implicit-def $sp
256 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
259 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
260 %50 = LUi64 target-flags(mips-call-hi16) &__tls_get_addr
261 %51 = DADDu killed %50, %6
262 %52 = LD killed %51, target-flags(mips-call-lo16) &__tls_get_addr :: (load (s64) from call-entry &__tls_get_addr)
263 %53 = DADDiu %6, target-flags(mips-tlsgd) @j
266 JALR64Pseudo killed %52, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0_64
267 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
269 %55 = LW %54, 0 :: (dereferenceable load (s32) from @j)
270 %56 = ADDu %4, killed %55