1 # RUN: llc -O0 -mtriple thumb-- -mattr=+v6t2,+hwdiv -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3 define void @test_add_regs() { ret void }
4 define void @test_add_fold_imm() { ret void }
5 define void @test_add_fold_imm12() { ret void }
6 define void @test_add_no_fold_imm() { ret void }
8 define void @test_sub_imm_lhs() { ret void }
9 define void @test_sub_imm_rhs() { ret void }
11 define void @test_mul() { ret void }
12 define void @test_mla() { ret void }
14 define void @test_sdiv() { ret void }
15 define void @test_udiv() { ret void }
19 # CHECK-LABEL: name: test_add_regs
23 # CHECK: selected: true
25 - { id: 0, class: gprb }
26 - { id: 1, class: gprb }
27 - { id: 2, class: gprb }
33 ; CHECK: [[VREGX:%[0-9]+]]:gprnopc = COPY $r0
36 ; CHECK: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
38 %2(s32) = G_ADD %0, %1
39 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = t2ADDrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
42 ; CHECK: $r0 = COPY [[VREGRES]]
44 BX_RET 14, $noreg, implicit $r0
45 ; CHECK: BX_RET 14, $noreg, implicit $r0
48 name: test_add_fold_imm
49 # CHECK-LABEL: name: test_add_fold_imm
53 # CHECK: selected: true
55 - { id: 0, class: gprb }
56 - { id: 1, class: gprb }
57 - { id: 2, class: gprb }
63 ; CHECK: [[VREGX:%[0-9]+]]:gprnopc = COPY $r0
65 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
66 %2(s32) = G_ADD %0, %1
67 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = t2ADDri [[VREGX]], 786444, 14, $noreg, $noreg
70 ; CHECK: $r0 = COPY [[VREGRES]]
72 BX_RET 14, $noreg, implicit $r0
73 ; CHECK: BX_RET 14, $noreg, implicit $r0
76 name: test_add_fold_imm12
77 # CHECK-LABEL: name: test_add_fold_imm12
81 # CHECK: selected: true
83 - { id: 0, class: gprb }
84 - { id: 1, class: gprb }
85 - { id: 2, class: gprb }
91 ; CHECK: [[VREGX:%[0-9]+]]:gpr = COPY $r0
93 %1(s32) = G_CONSTANT i32 4093
94 %2(s32) = G_ADD %0, %1
95 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = t2ADDri12 [[VREGX]], 4093, 14, $noreg
98 ; CHECK: $r0 = COPY [[VREGRES]]
100 BX_RET 14, $noreg, implicit $r0
101 ; CHECK: BX_RET 14, $noreg, implicit $r0
104 name: test_add_no_fold_imm
105 # CHECK-LABEL: name: test_add_no_fold_imm
107 regBankSelected: true
109 # CHECK: selected: true
111 - { id: 0, class: gprb }
112 - { id: 1, class: gprb }
113 - { id: 2, class: gprb }
119 ; CHECK: [[VREGX:%[0-9]+]]:gprnopc = COPY $r0
121 %1(s32) = G_CONSTANT i32 185470479 ; 0x0b0e0e0f
122 ; CHECK: [[VREGY:%[0-9]+]]:rgpr = t2MOVi32imm 185470479
124 %2(s32) = G_ADD %0, %1
125 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = t2ADDrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
128 ; CHECK: $r0 = COPY [[VREGRES]]
130 BX_RET 14, $noreg, implicit $r0
131 ; CHECK: BX_RET 14, $noreg, implicit $r0
134 name: test_sub_imm_lhs
135 # CHECK-LABEL: name: test_sub_imm_lhs
137 regBankSelected: true
139 # CHECK: selected: true
141 - { id: 0, class: gprb }
142 - { id: 1, class: gprb }
143 - { id: 2, class: gprb }
149 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
151 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
152 %2(s32) = G_SUB %1, %0
153 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2RSBri [[VREGX]], 786444, 14, $noreg, $noreg
156 ; CHECK: $r0 = COPY [[VREGRES]]
158 BX_RET 14, $noreg, implicit $r0
159 ; CHECK: BX_RET 14, $noreg, implicit $r0
162 name: test_sub_imm_rhs
163 # CHECK-LABEL: name: test_sub_imm_rhs
165 regBankSelected: true
167 # CHECK: selected: true
169 - { id: 0, class: gprb }
170 - { id: 1, class: gprb }
171 - { id: 2, class: gprb }
177 ; CHECK: [[VREGX:%[0-9]+]]:gprnopc = COPY $r0
179 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
180 %2(s32) = G_SUB %0, %1
181 ; CHECK: [[VREGRES:%[0-9]+]]:gprnopc = t2SUBri [[VREGX]], 786444, 14, $noreg, $noreg
184 ; CHECK: $r0 = COPY [[VREGRES]]
186 BX_RET 14, $noreg, implicit $r0
187 ; CHECK: BX_RET 14, $noreg, implicit $r0
191 # CHECK-LABEL: name: test_mul
193 regBankSelected: true
195 # CHECK: selected: true
197 - { id: 0, class: gprb }
198 - { id: 1, class: gprb }
199 - { id: 2, class: gprb }
205 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
208 ; CHECK: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
210 %2(s32) = G_MUL %0, %1
211 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2MUL [[VREGX]], [[VREGY]], 14, $noreg
214 ; CHECK: $r0 = COPY [[VREGRES]]
216 BX_RET 14, $noreg, implicit $r0
217 ; CHECK: BX_RET 14, $noreg, implicit $r0
221 # CHECK-LABEL: name: test_mla
223 regBankSelected: true
225 # CHECK: selected: true
227 - { id: 0, class: gprb }
228 - { id: 1, class: gprb }
229 - { id: 2, class: gprb }
230 - { id: 3, class: gprb }
231 - { id: 4, class: gprb }
234 liveins: $r0, $r1, $r2
237 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
240 ; CHECK: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
243 ; CHECK: [[VREGZ:%[0-9]+]]:rgpr = COPY $r2
245 %3(s32) = G_MUL %0, %1
246 %4(s32) = G_ADD %3, %2
247 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2MLA [[VREGX]], [[VREGY]], [[VREGZ]], 14, $noreg
250 ; CHECK: $r0 = COPY [[VREGRES]]
252 BX_RET 14, $noreg, implicit $r0
253 ; CHECK: BX_RET 14, $noreg, implicit $r0
257 # CHECK-LABEL: name: test_sdiv
259 regBankSelected: true
261 # CHECK: selected: true
263 - { id: 0, class: gprb }
264 - { id: 1, class: gprb }
265 - { id: 2, class: gprb }
271 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
274 ; CHECK: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
276 %2(s32) = G_SDIV %0, %1
277 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2SDIV [[VREGX]], [[VREGY]], 14, $noreg
280 ; CHECK: $r0 = COPY [[VREGRES]]
282 BX_RET 14, $noreg, implicit $r0
283 ; CHECK: BX_RET 14, $noreg, implicit $r0
287 # CHECK-LABEL: name: test_udiv
289 regBankSelected: true
291 # CHECK: selected: true
293 - { id: 0, class: gprb }
294 - { id: 1, class: gprb }
295 - { id: 2, class: gprb }
301 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
304 ; CHECK: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
306 %2(s32) = G_UDIV %0, %1
307 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2UDIV [[VREGX]], [[VREGY]], 14, $noreg
310 ; CHECK: $r0 = COPY [[VREGRES]]
312 BX_RET 14, $noreg, implicit $r0
313 ; CHECK: BX_RET 14, $noreg, implicit $r0