OLD | NEW |
1 ; Show that we know how to translate sdiv | 1 ; Show that we know how to translate udiv |
2 | 2 |
3 ; NOTE: We use -O2 to get rid of memory stores. | 3 ; NOTE: We use -O2 to get rid of memory stores. |
4 | 4 |
5 ; REQUIRES: allow_dump | 5 ; REQUIRES: allow_dump |
6 | 6 |
7 ; Compile using standalone assembler. | 7 ; Compile using standalone assembler. |
8 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 -mattr=hwdiv-arm \ | 8 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 -mattr=hwdiv-arm \ |
9 ; RUN: | FileCheck %s --check-prefix=ASM | 9 ; RUN: | FileCheck %s --check-prefix=ASM |
10 | 10 |
11 ; Show bytes in assembled standalone code. | 11 ; Show bytes in assembled standalone code. |
12 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \ | 12 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \ |
13 ; RUN: --args -O2 -mattr=hwdiv-arm | FileCheck %s --check-prefix=DIS | 13 ; RUN: --args -O2 -mattr=hwdiv-arm | FileCheck %s --check-prefix=DIS |
14 | 14 |
15 ; Compile using integrated assembler. | 15 ; Compile using integrated assembler. |
16 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -mattr=hwdiv-arm \ | 16 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -mattr=hwdiv-arm \ |
17 ; RUN: | FileCheck %s --check-prefix=IASM | 17 ; RUN: | FileCheck %s --check-prefix=IASM |
18 | 18 |
19 ; Show bytes in assembled integrated code. | 19 ; Show bytes in assembled integrated code. |
20 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \ | 20 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \ |
21 ; RUN: --args -O2 -mattr=hwdiv-arm | FileCheck %s --check-prefix=DIS | 21 ; RUN: --args -O2 -mattr=hwdiv-arm | FileCheck %s --check-prefix=DIS |
22 | 22 |
23 define internal i32 @SdivTwoRegs(i32 %a, i32 %b) { | 23 define internal i32 @UdivTwoRegs(i32 %a, i32 %b) { |
24 %v = sdiv i32 %a, %b | 24 %v = udiv i32 %a, %b |
25 ret i32 %v | 25 ret i32 %v |
26 } | 26 } |
27 | 27 |
28 ; ASM-LABEL:SdivTwoRegs: | 28 ; ASM-LABEL:UdivTwoRegs: |
29 ; ASM-NEXT:.LSdivTwoRegs$__0: | 29 ; ASM-NEXT:.LUdivTwoRegs$__0: |
30 ; ASM-NEXT: tst r1, r1 | 30 ; ASM-NEXT: tst r1, r1 |
31 ; ASM-NEXT: bne .LSdivTwoRegs$local$__0 | 31 ; ASM-NEXT: bne .LUdivTwoRegs$local$__0 |
32 ; ASM-NEXT: .long 0xe7fedef0 | 32 ; ASM-NEXT: .long 0xe7fedef0 |
33 ; ASM-NEXT:.LSdivTwoRegs$local$__0: | 33 ; ASM-NEXT:.LUdivTwoRegs$local$__0: |
34 ; ASM-NEXT: sdiv r0, r0, r1 | 34 ; ASM-NEXT: udiv r0, r0, r1 |
35 ; ASM-NEXT: bx lr | 35 ; ASM-NEXT: bx lr |
36 | 36 |
37 ; DIS-LABEL:00000000 <SdivTwoRegs>: | 37 ; DIS-LABEL:00000000 <UdivTwoRegs>: |
38 ; DIS-NEXT: 0: e1110001 | 38 ; DIS-NEXT: 0: e1110001 |
39 ; DIS-NEXT: 4: 1a000000 | 39 ; DIS-NEXT: 4: 1a000000 |
40 ; DIS-NEXT: 8: e7fedef0 | 40 ; DIS-NEXT: 8: e7fedef0 |
41 ; DIS-NEXT: c: e710f110 | 41 ; DIS-NEXT: c: e730f110 |
42 ; DIS-NEXT: 10: e12fff1e | 42 ; DIS-NEXT: 10: e12fff1e |
43 | 43 |
44 ; IASM-LABEL:SdivTwoRegs: | 44 ; IASM-LABEL:UdivTwoRegs: |
45 ; IASM-NEXT:.LSdivTwoRegs$__0: | 45 ; IASM-NEXT:.LUdivTwoRegs$__0: |
46 ; IASM-NEXT: tst r1, r1 | 46 ; IASM-NEXT: tst r1, r1 |
47 ; IASM-NEXT: .byte 0x0 | 47 ; IASM-NEXT: .byte 0x0 |
48 ; IASM-NEXT: .byte 0x0 | 48 ; IASM-NEXT: .byte 0x0 |
49 ; IASM-NEXT: .byte 0x0 | 49 ; IASM-NEXT: .byte 0x0 |
50 ; IASM-NEXT: .byte 0x1a | 50 ; IASM-NEXT: .byte 0x1a |
51 ; IASM-NEXT: .long 0xe7fedef0 | 51 ; IASM-NEXT: .long 0xe7fedef0 |
52 ; IASM-NEXT: .byte 0x10 | 52 ; IASM-NEXT: .byte 0x10 |
53 ; IASM-NEXT: .byte 0xf1 | 53 ; IASM-NEXT: .byte 0xf1 |
54 ; IASM-NEXT: .byte 0x10 | 54 ; IASM-NEXT: .byte 0x30 |
55 ; IASM-NEXT: .byte 0xe7 | 55 ; IASM-NEXT: .byte 0xe7 |
56 ; IASM-NEXT: .byte 0x1e | 56 ; IASM-NEXT: .byte 0x1e |
57 ; IASM-NEXT: .byte 0xff | 57 ; IASM-NEXT: .byte 0xff |
58 ; IASM-NEXT: .byte 0x2f | 58 ; IASM-NEXT: .byte 0x2f |
59 ; IASM-NEXT: .byte 0xe1 | 59 ; IASM-NEXT: .byte 0xe1 |
OLD | NEW |