1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple thumb-- -mattr=+v6t2,+hwdiv -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
4 define void @test_add_regs() { ret void }
5 define void @test_add_fold_imm() { ret void }
6 define void @test_add_fold_imm12() { ret void }
7 define void @test_add_no_fold_imm() { ret void }
9 define void @test_sub_imm_lhs() { ret void }
10 define void @test_sub_imm_rhs() { ret void }
12 define void @test_mul() { ret void }
13 define void @test_mla() { ret void }
15 define void @test_sdiv() { ret void }
16 define void @test_udiv() { ret void }
24 - { id: 0, class: gprb }
25 - { id: 1, class: gprb }
26 - { id: 2, class: gprb }
31 ; CHECK-LABEL: name: test_add_regs
32 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
33 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
34 ; CHECK: [[t2ADDrr:%[0-9]+]]:gprnopc = t2ADDrr [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg, $noreg
35 ; CHECK: $r0 = COPY [[t2ADDrr]]
36 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
41 %2(s32) = G_ADD %0, %1
45 BX_RET 14, $noreg, implicit $r0
48 name: test_add_fold_imm
53 - { id: 0, class: gprb }
54 - { id: 1, class: gprb }
55 - { id: 2, class: gprb }
60 ; CHECK-LABEL: name: test_add_fold_imm
61 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
62 ; CHECK: [[t2ADDri:%[0-9]+]]:rgpr = t2ADDri [[COPY]], 786444, 14 /* CC::al */, $noreg, $noreg
63 ; CHECK: $r0 = COPY [[t2ADDri]]
64 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
67 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
68 %2(s32) = G_ADD %0, %1
72 BX_RET 14, $noreg, implicit $r0
75 name: test_add_fold_imm12
80 - { id: 0, class: gprb }
81 - { id: 1, class: gprb }
82 - { id: 2, class: gprb }
87 ; CHECK-LABEL: name: test_add_fold_imm12
88 ; CHECK: [[COPY:%[0-9]+]]:gpr = COPY $r0
89 ; CHECK: [[t2ADDri12_:%[0-9]+]]:rgpr = t2ADDri12 [[COPY]], 4093, 14 /* CC::al */, $noreg
90 ; CHECK: $r0 = COPY [[t2ADDri12_]]
91 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
94 %1(s32) = G_CONSTANT i32 4093
95 %2(s32) = G_ADD %0, %1
99 BX_RET 14, $noreg, implicit $r0
102 name: test_add_no_fold_imm
104 regBankSelected: true
107 - { id: 0, class: gprb }
108 - { id: 1, class: gprb }
109 - { id: 2, class: gprb }
114 ; CHECK-LABEL: name: test_add_no_fold_imm
115 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
116 ; CHECK: [[t2MOVi32imm:%[0-9]+]]:rgpr = t2MOVi32imm 185470479
117 ; CHECK: [[t2ADDrr:%[0-9]+]]:gprnopc = t2ADDrr [[COPY]], [[t2MOVi32imm]], 14 /* CC::al */, $noreg, $noreg
118 ; CHECK: $r0 = COPY [[t2ADDrr]]
119 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
122 %1(s32) = G_CONSTANT i32 185470479 ; 0x0b0e0e0f
124 %2(s32) = G_ADD %0, %1
128 BX_RET 14, $noreg, implicit $r0
131 name: test_sub_imm_lhs
133 regBankSelected: true
136 - { id: 0, class: gprb }
137 - { id: 1, class: gprb }
138 - { id: 2, class: gprb }
143 ; CHECK-LABEL: name: test_sub_imm_lhs
144 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r0
145 ; CHECK: [[t2RSBri:%[0-9]+]]:rgpr = t2RSBri [[COPY]], 786444, 14 /* CC::al */, $noreg, $noreg
146 ; CHECK: $r0 = COPY [[t2RSBri]]
147 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
150 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
151 %2(s32) = G_SUB %1, %0
155 BX_RET 14, $noreg, implicit $r0
158 name: test_sub_imm_rhs
160 regBankSelected: true
163 - { id: 0, class: gprb }
164 - { id: 1, class: gprb }
165 - { id: 2, class: gprb }
170 ; CHECK-LABEL: name: test_sub_imm_rhs
171 ; CHECK: [[COPY:%[0-9]+]]:gprnopc = COPY $r0
172 ; CHECK: [[t2SUBri:%[0-9]+]]:rgpr = t2SUBri [[COPY]], 786444, 14 /* CC::al */, $noreg, $noreg
173 ; CHECK: $r0 = COPY [[t2SUBri]]
174 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
177 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
178 %2(s32) = G_SUB %0, %1
182 BX_RET 14, $noreg, implicit $r0
187 regBankSelected: true
190 - { id: 0, class: gprb }
191 - { id: 1, class: gprb }
192 - { id: 2, class: gprb }
197 ; CHECK-LABEL: name: test_mul
198 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r0
199 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
200 ; CHECK: [[t2MUL:%[0-9]+]]:rgpr = t2MUL [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
201 ; CHECK: $r0 = COPY [[t2MUL]]
202 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
207 %2(s32) = G_MUL %0, %1
211 BX_RET 14, $noreg, implicit $r0
216 regBankSelected: true
219 - { id: 0, class: gprb }
220 - { id: 1, class: gprb }
221 - { id: 2, class: gprb }
222 - { id: 3, class: gprb }
223 - { id: 4, class: gprb }
226 liveins: $r0, $r1, $r2
228 ; CHECK-LABEL: name: test_mla
229 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r0
230 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
231 ; CHECK: [[COPY2:%[0-9]+]]:rgpr = COPY $r2
232 ; CHECK: [[t2MLA:%[0-9]+]]:rgpr = t2MLA [[COPY]], [[COPY1]], [[COPY2]], 14 /* CC::al */, $noreg
233 ; CHECK: $r0 = COPY [[t2MLA]]
234 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
241 %3(s32) = G_MUL %0, %1
242 %4(s32) = G_ADD %3, %2
246 BX_RET 14, $noreg, implicit $r0
251 regBankSelected: true
254 - { id: 0, class: gprb }
255 - { id: 1, class: gprb }
256 - { id: 2, class: gprb }
261 ; CHECK-LABEL: name: test_sdiv
262 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r0
263 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
264 ; CHECK: [[t2SDIV:%[0-9]+]]:rgpr = t2SDIV [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
265 ; CHECK: $r0 = COPY [[t2SDIV]]
266 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
271 %2(s32) = G_SDIV %0, %1
275 BX_RET 14, $noreg, implicit $r0
280 regBankSelected: true
283 - { id: 0, class: gprb }
284 - { id: 1, class: gprb }
285 - { id: 2, class: gprb }
290 ; CHECK-LABEL: name: test_udiv
291 ; CHECK: [[COPY:%[0-9]+]]:rgpr = COPY $r0
292 ; CHECK: [[COPY1:%[0-9]+]]:rgpr = COPY $r1
293 ; CHECK: [[t2UDIV:%[0-9]+]]:rgpr = t2UDIV [[COPY]], [[COPY1]], 14 /* CC::al */, $noreg
294 ; CHECK: $r0 = COPY [[t2UDIV]]
295 ; CHECK: BX_RET 14 /* CC::al */, $noreg, implicit $r0
300 %2(s32) = G_UDIV %0, %1
304 BX_RET 14, $noreg, implicit $r0