1 # RUN: llc -march=mips64 -target-abi n64 -start-before=finalize-isel \
2 # RUN: -stop-after=finalize-isel -relocation-model=static -o /dev/null %s
4 # A simple test to show that we can parse the target specific flags: highest,
5 # higher, hi, lo, tprel-lo, tprel-hi, gpoff-hi, gpoff-lo, gottprel.
8 @v = global i32 0, align 4
9 @k = thread_local global i32 0, align 4
10 @j = external thread_local global i32, align 4
11 @__tls_guard = internal thread_local global i1 false, align 1
13 declare i32 @_Z1gi(i32 signext)
15 declare extern_weak void @_ZTH1j()
17 define i32 @_Z2k1i(i32 signext %asd) {
19 %call = tail call i32 @_Z1gi(i32 signext %asd)
20 %add = add nsw i32 %call, %asd
21 %0 = load i32, i32* @v, align 4
22 %add1 = add nsw i32 %add, %0
23 %.b.i.i = load i1, i1* @__tls_guard, align 1
24 br i1 %.b.i.i, label %entry._ZTW1k.exit_crit_edge, label %init.i.i
26 entry._ZTW1k.exit_crit_edge:
27 %.pre = load i32, i32* @k, align 4
31 store i1 true, i1* @__tls_guard, align 1
32 %call.i.i.i = tail call i32 @_Z1gi(i32 signext 3)
33 store i32 %call.i.i.i, i32* @k, align 4
37 %1 = phi i32 [ %.pre, %entry._ZTW1k.exit_crit_edge ], [ %call.i.i.i, %init.i.i ]
38 %add2 = add nsw i32 %add1, %1
39 br i1 icmp ne (void ()* @_ZTH1j, void ()* null), label %2, label %_ZTW1j.exit
42 tail call void @_ZTH1j()
46 %3 = load i32, i32* @j, align 4
47 %add3 = add nsw i32 %add2, %3
54 exposesReturnsTwice: false
56 regBankSelected: false
58 tracksRegLiveness: true
60 - { id: 0, class: gpr32, preferred-register: '' }
61 - { id: 1, class: gpr32, preferred-register: '' }
62 - { id: 2, class: gpr32, preferred-register: '' }
63 - { id: 3, class: gpr32, preferred-register: '' }
64 - { id: 4, class: gpr32, preferred-register: '' }
65 - { id: 5, class: gpr64, preferred-register: '' }
66 - { id: 6, class: gpr32, preferred-register: '' }
67 - { id: 7, class: gpr32, preferred-register: '' }
68 - { id: 8, class: gpr32, preferred-register: '' }
69 - { id: 9, class: gpr64, preferred-register: '' }
70 - { id: 10, class: gpr64, preferred-register: '' }
71 - { id: 11, class: gpr64, preferred-register: '' }
72 - { id: 12, class: gpr64, preferred-register: '' }
73 - { id: 13, class: gpr64, preferred-register: '' }
74 - { id: 14, class: gpr32, preferred-register: '' }
75 - { id: 15, class: gpr64, preferred-register: '' }
76 - { id: 16, class: gpr64, preferred-register: '' }
77 - { id: 17, class: gpr64, preferred-register: '' }
78 - { id: 18, class: gpr64, preferred-register: '' }
79 - { id: 19, class: gpr64, preferred-register: '' }
80 - { id: 20, class: gpr32, preferred-register: '' }
81 - { id: 21, class: gpr64, preferred-register: '' }
82 - { id: 22, class: gpr64, preferred-register: '' }
83 - { id: 23, class: gpr64, preferred-register: '' }
84 - { id: 24, class: gpr64, preferred-register: '' }
85 - { id: 25, class: gpr64, preferred-register: '' }
86 - { id: 26, class: gpr32, preferred-register: '' }
87 - { id: 27, class: gpr64, preferred-register: '' }
88 - { id: 28, class: gpr64, preferred-register: '' }
89 - { id: 29, class: gpr64, preferred-register: '' }
90 - { id: 30, class: gpr64, preferred-register: '' }
91 - { id: 31, class: gpr32, preferred-register: '' }
92 - { id: 32, class: gpr64, preferred-register: '' }
93 - { id: 33, class: gpr64, preferred-register: '' }
94 - { id: 34, class: gpr64, preferred-register: '' }
95 - { id: 35, class: gpr64, preferred-register: '' }
96 - { id: 36, class: gpr64, preferred-register: '' }
97 - { id: 37, class: gpr64, preferred-register: '' }
98 - { id: 38, class: gpr64, preferred-register: '' }
99 - { id: 39, class: gpr64, preferred-register: '' }
100 - { id: 40, class: gpr64, preferred-register: '' }
101 - { id: 41, class: gpr64, preferred-register: '' }
102 - { id: 42, class: gpr64, preferred-register: '' }
103 - { id: 43, class: gpr64, preferred-register: '' }
104 - { id: 44, class: gpr64, preferred-register: '' }
105 - { id: 45, class: gpr64, preferred-register: '' }
106 - { id: 46, class: gpr64, preferred-register: '' }
107 - { id: 47, class: gpr64, preferred-register: '' }
108 - { id: 48, class: gpr32, preferred-register: '' }
109 - { id: 49, class: gpr32, preferred-register: '' }
110 - { id: 50, class: gpr64, preferred-register: '' }
111 - { id: 51, class: gpr64, preferred-register: '' }
113 - { reg: '$a0_64', virtual-reg: '%5' }
114 - { reg: '$t9_64', virtual-reg: '' }
116 isFrameAddressTaken: false
117 isReturnAddressTaken: false
126 maxCallFrameSize: 4294967295
127 hasOpaqueSPAdjustment: false
129 hasMustTailInVarArgFunc: false
137 successors: %bb.1.entry._ZTW1k.exit_crit_edge(0x7fe00000), %bb.2.init.i.i(0x00200000)
138 liveins: $a0_64, $t9_64
140 %50 = LUi64 target-flags(mips-gpoff-hi) @_Z2k1i
141 %51 = DADDu %50, $t9_64
142 %43 = DADDiu %51, target-flags(mips-gpoff-lo) @_Z2k1i
144 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
147 JAL @_Z1gi, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0
148 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
150 %8 = ADDu %7, killed %6
151 %9 = LUi64 target-flags(mips-highest) @v
152 %10 = DADDiu killed %9, target-flags(mips-higher) @v
153 %11 = DSLL killed %10, 16
154 %12 = DADDiu killed %11, target-flags(mips-abs-hi) @v
155 %13 = DSLL killed %12, 16
156 %14 = LW killed %13, target-flags(mips-abs-lo) @v :: (dereferenceable load 4 from @v)
157 %0 = ADDu killed %8, killed %14
158 %15 = LUi64 target-flags(mips-tprel-hi) @__tls_guard
159 %16 = DADDiu killed %15, target-flags(mips-tprel-lo) @__tls_guard
160 %17 = RDHWR64 $hwr29, 0
163 %19 = DADDu %18, killed %16
164 %20 = LBu killed %19, 0 :: (dereferenceable load 1 from @__tls_guard)
165 BEQ killed %20, $zero, %bb.2.init.i.i, implicit-def dead $at
166 J %bb.1.entry._ZTW1k.exit_crit_edge, implicit-def dead $at
168 bb.1.entry._ZTW1k.exit_crit_edge:
169 successors: %bb.3._ZTW1k.exit(0x80000000)
171 %32 = LUi64 target-flags(mips-tprel-hi) @k
172 %33 = DADDiu killed %32, target-flags(mips-tprel-lo) @k
173 %34 = RDHWR64 $hwr29, 0
176 %36 = DADDu %35, killed %33
177 %1 = LW killed %36, 0 :: (dereferenceable load 4 from @k)
178 J %bb.3._ZTW1k.exit, implicit-def dead $at
181 successors: %bb.3._ZTW1k.exit(0x80000000)
183 %21 = LUi64 target-flags(mips-tprel-hi) @__tls_guard
184 %22 = DADDiu killed %21, target-flags(mips-tprel-lo) @__tls_guard
185 %23 = RDHWR64 $hwr29, 0
188 %25 = DADDu %24, killed %22
190 SB killed %26, killed %25, 0 :: (store 1 into @__tls_guard)
191 %27 = LUi64 target-flags(mips-tprel-hi) @k
192 %28 = DADDiu killed %27, target-flags(mips-tprel-lo) @k
193 %29 = DADDu %24, killed %28
194 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
195 %30 = DADDiu $zero_64, 3
197 JAL @_Z1gi, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit-def $sp, implicit-def $v0
198 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
200 SW %31, killed %29, 0 :: (store 4 into @k)
204 successors: %bb.4(0x40000000), %bb.5._ZTW1j.exit(0x40000000)
206 %3 = PHI %2, %bb.2.init.i.i, %1, %bb.1.entry._ZTW1k.exit_crit_edge
208 %37 = LUi64 target-flags(mips-highest) @_ZTH1j
209 %38 = DADDiu killed %37, target-flags(mips-higher) @_ZTH1j
210 %39 = DSLL killed %38, 16
211 %40 = DADDiu killed %39, target-flags(mips-abs-hi) @_ZTH1j
212 %41 = DSLL killed %40, 16
213 %42 = DADDiu killed %41, target-flags(mips-abs-lo) @_ZTH1j
214 BEQ64 killed %42, $zero_64, %bb.5._ZTW1j.exit, implicit-def dead $at
215 J %bb.4, implicit-def dead $at
218 successors: %bb.5._ZTW1j.exit(0x80000000)
220 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
221 JAL @_ZTH1j, csr_n64, implicit-def dead $ra, implicit-def $sp
222 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
225 %44 = RDHWR64 $hwr29, 0
227 %45 = LD %43, target-flags(mips-gottprel) @j :: (load 8)
229 %47 = DADDu %46, killed %45
230 %48 = LW killed %47, 0 :: (dereferenceable load 4 from @j)
231 %49 = ADDu %4, killed %48