Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: tests_lit/llvm2ice_tests/64bit.pnacl.ll

Issue 1214693004: ARM lowering integer divide and remainder, with div by 0 checks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review fixes Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | tests_lit/llvm2ice_tests/arith.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; This tries to be a comprehensive test of i64 operations, in 1 ; This tries to be a comprehensive test of i64 operations, in
2 ; particular the patterns for lowering i64 operations into constituent 2 ; particular the patterns for lowering i64 operations into constituent
3 ; i32 operations on x86-32. 3 ; i32 operations on x86-32.
4 4
5 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 5 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
6 ; RUN: --target x8632 -i %s --args -O2 \ 6 ; RUN: --target x8632 -i %s --args -O2 \
7 ; RUN: | %if --need=target_X8632 --command FileCheck %s 7 ; RUN: | %if --need=target_X8632 --command FileCheck %s
8 8
9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
10 ; RUN: --target x8632 -i %s --args -Om1 \ 10 ; RUN: --target x8632 -i %s --args -Om1 \
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 define internal i64 @div64BitSigned(i64 %a, i64 %b) { 308 define internal i64 @div64BitSigned(i64 %a, i64 %b) {
309 entry: 309 entry:
310 %div = sdiv i64 %a, %b 310 %div = sdiv i64 %a, %b
311 ret i64 %div 311 ret i64 %div
312 } 312 }
313 ; CHECK-LABEL: div64BitSigned 313 ; CHECK-LABEL: div64BitSigned
314 ; CHECK: call {{.*}} R_{{.*}} __divdi3 314 ; CHECK: call {{.*}} R_{{.*}} __divdi3
315 315
316 ; OPTM1-LABEL: div64BitSigned 316 ; OPTM1-LABEL: div64BitSigned
317 ; OPTM1: call {{.*}} R_{{.*}} __divdi3 317 ; OPTM1: call {{.*}} R_{{.*}} __divdi3
318 ;
319 ; ARM32-LABEL: div64BitSigned
320 ; ARM32: orrs {{r.*}}, {{r.*}}
321 ; ARM32: bne
322 ; ARM32: bl {{.*}} __divdi3
318 323
319 define internal i64 @div64BitSignedConst(i64 %a) { 324 define internal i64 @div64BitSignedConst(i64 %a) {
320 entry: 325 entry:
321 %div = sdiv i64 %a, 12345678901234 326 %div = sdiv i64 %a, 12345678901234
322 ret i64 %div 327 ret i64 %div
323 } 328 }
324 ; CHECK-LABEL: div64BitSignedConst 329 ; CHECK-LABEL: div64BitSignedConst
325 ; CHECK: mov DWORD PTR [esp+0xc],0xb3a 330 ; CHECK: mov DWORD PTR [esp+0xc],0xb3a
326 ; CHECK: mov DWORD PTR [esp+0x8],0x73ce2ff2 331 ; CHECK: mov DWORD PTR [esp+0x8],0x73ce2ff2
327 ; CHECK: call {{.*}} R_{{.*}} __divdi3 332 ; CHECK: call {{.*}} R_{{.*}} __divdi3
328 ; 333 ;
329 ; OPTM1-LABEL: div64BitSignedConst 334 ; OPTM1-LABEL: div64BitSignedConst
330 ; OPTM1: mov DWORD PTR [esp+0xc],0xb3a 335 ; OPTM1: mov DWORD PTR [esp+0xc],0xb3a
331 ; OPTM1: mov DWORD PTR [esp+0x8],0x73ce2ff2 336 ; OPTM1: mov DWORD PTR [esp+0x8],0x73ce2ff2
332 ; OPTM1: call {{.*}} R_{{.*}} __divdi3 337 ; OPTM1: call {{.*}} R_{{.*}} __divdi3
338 ;
339 ; ARM32-LABEL: div64BitSignedConst
340 ; For a constant, we should be able to optimize-out the divide by zero check.
341 ; ARM32-NOT: orrs
342 ; ARM32: movw {{.*}} ; 0x2ff2
343 ; ARM32: movt {{.*}} ; 0x73ce
344 ; ARM32: movw {{.*}} ; 0xb3a
345 ; ARM32: bl {{.*}} __divdi3
333 346
334 define internal i64 @div64BitUnsigned(i64 %a, i64 %b) { 347 define internal i64 @div64BitUnsigned(i64 %a, i64 %b) {
335 entry: 348 entry:
336 %div = udiv i64 %a, %b 349 %div = udiv i64 %a, %b
337 ret i64 %div 350 ret i64 %div
338 } 351 }
339 ; CHECK-LABEL: div64BitUnsigned 352 ; CHECK-LABEL: div64BitUnsigned
340 ; CHECK: call {{.*}} R_{{.*}} __udivdi3 353 ; CHECK: call {{.*}} R_{{.*}} __udivdi3
341 ; 354 ;
342 ; OPTM1-LABEL: div64BitUnsigned 355 ; OPTM1-LABEL: div64BitUnsigned
343 ; OPTM1: call {{.*}} R_{{.*}} __udivdi3 356 ; OPTM1: call {{.*}} R_{{.*}} __udivdi3
357 ;
358 ; ARM32-LABEL: div64BitUnsigned
359 ; ARM32: orrs {{r.*}}, {{r.*}}
360 ; ARM32: bne
361 ; ARM32: bl {{.*}} __udivdi3
344 362
345 define internal i64 @rem64BitSigned(i64 %a, i64 %b) { 363 define internal i64 @rem64BitSigned(i64 %a, i64 %b) {
346 entry: 364 entry:
347 %rem = srem i64 %a, %b 365 %rem = srem i64 %a, %b
348 ret i64 %rem 366 ret i64 %rem
349 } 367 }
350 ; CHECK-LABEL: rem64BitSigned 368 ; CHECK-LABEL: rem64BitSigned
351 ; CHECK: call {{.*}} R_{{.*}} __moddi3 369 ; CHECK: call {{.*}} R_{{.*}} __moddi3
352 ; 370 ;
353 ; OPTM1-LABEL: rem64BitSigned 371 ; OPTM1-LABEL: rem64BitSigned
354 ; OPTM1: call {{.*}} R_{{.*}} __moddi3 372 ; OPTM1: call {{.*}} R_{{.*}} __moddi3
373 ;
374 ; ARM32-LABEL: rem64BitSigned
375 ; ARM32: orrs {{r.*}}, {{r.*}}
376 ; ARM32: bne
377 ; ARM32: bl {{.*}} __moddi3
355 378
356 define internal i64 @rem64BitUnsigned(i64 %a, i64 %b) { 379 define internal i64 @rem64BitUnsigned(i64 %a, i64 %b) {
357 entry: 380 entry:
358 %rem = urem i64 %a, %b 381 %rem = urem i64 %a, %b
359 ret i64 %rem 382 ret i64 %rem
360 } 383 }
361 ; CHECK-LABEL: rem64BitUnsigned 384 ; CHECK-LABEL: rem64BitUnsigned
362 ; CHECK: call {{.*}} R_{{.*}} __umoddi3 385 ; CHECK: call {{.*}} R_{{.*}} __umoddi3
363 ; 386 ;
364 ; OPTM1-LABEL: rem64BitUnsigned 387 ; OPTM1-LABEL: rem64BitUnsigned
365 ; OPTM1: call {{.*}} R_{{.*}} __umoddi3 388 ; OPTM1: call {{.*}} R_{{.*}} __umoddi3
389 ;
390 ; ARM32-LABEL: rem64BitUnsigned
391 ; ARM32: orrs {{r.*}}, {{r.*}}
392 ; ARM32: bne
393 ; ARM32: bl {{.*}} __umoddi3
366 394
367 define internal i64 @shl64BitSigned(i64 %a, i64 %b) { 395 define internal i64 @shl64BitSigned(i64 %a, i64 %b) {
368 entry: 396 entry:
369 %shl = shl i64 %a, %b 397 %shl = shl i64 %a, %b
370 ret i64 %shl 398 ret i64 %shl
371 } 399 }
372 ; CHECK-LABEL: shl64BitSigned 400 ; CHECK-LABEL: shl64BitSigned
373 ; CHECK: shld 401 ; CHECK: shld
374 ; CHECK: shl e 402 ; CHECK: shl e
375 ; CHECK: test {{.*}},0x20 403 ; CHECK: test {{.*}},0x20
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 ret void 1743 ret void
1716 } 1744 }
1717 ; The following checks are not strictly necessary since one of the RUN 1745 ; The following checks are not strictly necessary since one of the RUN
1718 ; lines actually runs the output through the assembler. 1746 ; lines actually runs the output through the assembler.
1719 ; CHECK-LABEL: icmpLt64Imm 1747 ; CHECK-LABEL: icmpLt64Imm
1720 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}}, 1748 ; CHECK-NOT: cmp 0x{{[0-9a-f]+}},
1721 ; OPTM1-LABEL: icmpLt64Imm 1749 ; OPTM1-LABEL: icmpLt64Imm
1722 ; OPTM1-NOT: cmp 0x{{[0-9a-f]+}}, 1750 ; OPTM1-NOT: cmp 0x{{[0-9a-f]+}},
1723 ; ARM32-LABEL: icmpLt64Imm 1751 ; ARM32-LABEL: icmpLt64Imm
1724 ; ARM32-NOT: cmp #{{[0-9a-f]+}}, 1752 ; ARM32-NOT: cmp #{{[0-9a-f]+}},
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.cpp ('k') | tests_lit/llvm2ice_tests/arith.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698