OLD | NEW |
1 ; Assembly test for simple arithmetic operations. | 1 ; Assembly test for simple arithmetic operations. |
2 | 2 |
3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
4 ; RUN: --target x8632 -i %s --args -O2 \ | 4 ; RUN: --target x8632 -i %s --args -O2 \ |
5 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
6 | 6 |
7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) | 7 ; TODO(jvoung): Stop skipping unimplemented parts (via --skip-unimplemented) |
8 ; once enough infrastructure is in. Also, switch to --filetype=obj | 8 ; once enough infrastructure is in. Also, switch to --filetype=obj |
9 ; when possible. | 9 ; when possible. |
10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ; ARM32: bne | 164 ; ARM32: bne |
165 ; The following instruction is ".word 0xe7fedef0 = udf #60896 ; 0xede0". | 165 ; The following instruction is ".word 0xe7fedef0 = udf #60896 ; 0xede0". |
166 ; ARM32: e7fedef0 | 166 ; ARM32: e7fedef0 |
167 ; ARM32: bl {{.*}} __divsi3 | 167 ; ARM32: bl {{.*}} __divsi3 |
168 ; ARM32HWDIV-LABEL: Sdiv | 168 ; ARM32HWDIV-LABEL: Sdiv |
169 ; ARM32HWDIV: tst | 169 ; ARM32HWDIV: tst |
170 ; ARM32HWDIV: bne | 170 ; ARM32HWDIV: bne |
171 ; ARM32HWDIV: sdiv | 171 ; ARM32HWDIV: sdiv |
172 | 172 |
173 ; MIPS32-LABEL: Sdiv | 173 ; MIPS32-LABEL: Sdiv |
| 174 ; MIPS32: div |
| 175 ; MIPS32: mflo |
174 | 176 |
175 define internal i32 @SdivConst(i32 %a) { | 177 define internal i32 @SdivConst(i32 %a) { |
176 entry: | 178 entry: |
177 %div = sdiv i32 %a, 219 | 179 %div = sdiv i32 %a, 219 |
178 ret i32 %div | 180 ret i32 %div |
179 } | 181 } |
180 ; CHECK-LABEL: SdivConst | 182 ; CHECK-LABEL: SdivConst |
181 ; CHECK: cdq | 183 ; CHECK: cdq |
182 ; CHECK: idiv e | 184 ; CHECK: idiv e |
183 ; | 185 ; |
184 ; ARM32-LABEL: SdivConst | 186 ; ARM32-LABEL: SdivConst |
185 ; ARM32-NOT: tst | 187 ; ARM32-NOT: tst |
186 ; ARM32: bl {{.*}} __divsi3 | 188 ; ARM32: bl {{.*}} __divsi3 |
187 ; ARM32HWDIV-LABEL: SdivConst | 189 ; ARM32HWDIV-LABEL: SdivConst |
188 ; ARM32HWDIV-NOT: tst | 190 ; ARM32HWDIV-NOT: tst |
189 ; ARM32HWDIV: sdiv | 191 ; ARM32HWDIV: sdiv |
190 | 192 |
191 ; MIPS32-LABEL: SdivConst | 193 ; MIPS32-LABEL: SdivConst |
| 194 ; MIPS32: div |
| 195 ; MIPS32: mflo |
192 | 196 |
193 define internal i32 @Srem(i32 %a, i32 %b) { | 197 define internal i32 @Srem(i32 %a, i32 %b) { |
194 entry: | 198 entry: |
195 %rem = srem i32 %a, %b | 199 %rem = srem i32 %a, %b |
196 ret i32 %rem | 200 ret i32 %rem |
197 } | 201 } |
198 ; CHECK-LABEL: Srem | 202 ; CHECK-LABEL: Srem |
199 ; CHECK: cdq | 203 ; CHECK: cdq |
200 ; CHECK: idiv e | 204 ; CHECK: idiv e |
201 ; | 205 ; |
202 ; ARM32-LABEL: Srem | 206 ; ARM32-LABEL: Srem |
203 ; ARM32: tst [[DENOM:r.*]], [[DENOM]] | 207 ; ARM32: tst [[DENOM:r.*]], [[DENOM]] |
204 ; ARM32: bne | 208 ; ARM32: bne |
205 ; ARM32: bl {{.*}} __modsi3 | 209 ; ARM32: bl {{.*}} __modsi3 |
206 ; ARM32HWDIV-LABEL: Srem | 210 ; ARM32HWDIV-LABEL: Srem |
207 ; ARM32HWDIV: tst | 211 ; ARM32HWDIV: tst |
208 ; ARM32HWDIV: bne | 212 ; ARM32HWDIV: bne |
209 ; ARM32HWDIV: sdiv | 213 ; ARM32HWDIV: sdiv |
210 ; ARM32HWDIV: mls | 214 ; ARM32HWDIV: mls |
211 | 215 |
212 ; MIPS32-LABEL: Srem | 216 ; MIPS32-LABEL: Srem |
| 217 ; MIPS32: div |
| 218 ; MIPS32: mfhi |
213 | 219 |
214 define internal i32 @Udiv(i32 %a, i32 %b) { | 220 define internal i32 @Udiv(i32 %a, i32 %b) { |
215 entry: | 221 entry: |
216 %div = udiv i32 %a, %b | 222 %div = udiv i32 %a, %b |
217 ret i32 %div | 223 ret i32 %div |
218 } | 224 } |
219 ; CHECK-LABEL: Udiv | 225 ; CHECK-LABEL: Udiv |
220 ; CHECK: div e | 226 ; CHECK: div e |
221 ; | 227 ; |
222 ; ARM32-LABEL: Udiv | 228 ; ARM32-LABEL: Udiv |
223 ; ARM32: tst [[DENOM:r.*]], [[DENOM]] | 229 ; ARM32: tst [[DENOM:r.*]], [[DENOM]] |
224 ; ARM32: bne | 230 ; ARM32: bne |
225 ; ARM32: bl {{.*}} __udivsi3 | 231 ; ARM32: bl {{.*}} __udivsi3 |
226 ; ARM32HWDIV-LABEL: Udiv | 232 ; ARM32HWDIV-LABEL: Udiv |
227 ; ARM32HWDIV: tst | 233 ; ARM32HWDIV: tst |
228 ; ARM32HWDIV: bne | 234 ; ARM32HWDIV: bne |
229 ; ARM32HWDIV: udiv | 235 ; ARM32HWDIV: udiv |
230 | 236 |
231 ; MIPS32-LABEL: Udiv | 237 ; MIPS32-LABEL: Udiv |
| 238 ; MIPS32: divu |
| 239 ; MIPS32: mflo |
232 | 240 |
233 define internal i32 @Urem(i32 %a, i32 %b) { | 241 define internal i32 @Urem(i32 %a, i32 %b) { |
234 entry: | 242 entry: |
235 %rem = urem i32 %a, %b | 243 %rem = urem i32 %a, %b |
236 ret i32 %rem | 244 ret i32 %rem |
237 } | 245 } |
238 ; CHECK-LABEL: Urem | 246 ; CHECK-LABEL: Urem |
239 ; CHECK: div e | 247 ; CHECK: div e |
240 ; | 248 ; |
241 ; ARM32-LABEL: Urem | 249 ; ARM32-LABEL: Urem |
242 ; ARM32: tst [[DENOM:r.*]], [[DENOM]] | 250 ; ARM32: tst [[DENOM:r.*]], [[DENOM]] |
243 ; ARM32: bne | 251 ; ARM32: bne |
244 ; ARM32: bl {{.*}} __umodsi3 | 252 ; ARM32: bl {{.*}} __umodsi3 |
245 ; ARM32HWDIV-LABEL: Urem | 253 ; ARM32HWDIV-LABEL: Urem |
246 ; ARM32HWDIV: tst | 254 ; ARM32HWDIV: tst |
247 ; ARM32HWDIV: bne | 255 ; ARM32HWDIV: bne |
248 ; ARM32HWDIV: udiv | 256 ; ARM32HWDIV: udiv |
249 ; ARM32HWDIV: mls | 257 ; ARM32HWDIV: mls |
250 | 258 |
251 ; MIPS32-LABEL: Urem | 259 ; MIPS32-LABEL: Urem |
| 260 ; MIPS32: divu |
| 261 ; MIPS32: mfhi |
252 | 262 |
253 ; The following tests check that shift instructions don't try to use a | 263 ; The following tests check that shift instructions don't try to use a |
254 ; ConstantRelocatable as an immediate operand. | 264 ; ConstantRelocatable as an immediate operand. |
255 | 265 |
256 @G = internal global [4 x i8] zeroinitializer, align 4 | 266 @G = internal global [4 x i8] zeroinitializer, align 4 |
257 | 267 |
258 define internal i32 @ShlReloc(i32 %a) { | 268 define internal i32 @ShlReloc(i32 %a) { |
259 entry: | 269 entry: |
260 %opnd = ptrtoint [4 x i8]* @G to i32 | 270 %opnd = ptrtoint [4 x i8]* @G to i32 |
261 %result = shl i32 %a, %opnd | 271 %result = shl i32 %a, %opnd |
(...skipping 12 matching lines...) Expand all Loading... |
274 ; CHECK: shr {{.*}},cl | 284 ; CHECK: shr {{.*}},cl |
275 | 285 |
276 define internal i32 @AshrReloc(i32 %a) { | 286 define internal i32 @AshrReloc(i32 %a) { |
277 entry: | 287 entry: |
278 %opnd = ptrtoint [4 x i8]* @G to i32 | 288 %opnd = ptrtoint [4 x i8]* @G to i32 |
279 %result = ashr i32 %a, %opnd | 289 %result = ashr i32 %a, %opnd |
280 ret i32 %result | 290 ret i32 %result |
281 } | 291 } |
282 ; CHECK-LABEL: AshrReloc | 292 ; CHECK-LABEL: AshrReloc |
283 ; CHECK: sar {{.*}},cl | 293 ; CHECK: sar {{.*}},cl |
OLD | NEW |