OLD | NEW |
1 ; Show that we know how to translate instruction sub. | 1 ; Show that we know how to translate instruction sub. |
2 ; TODO(kschimpf) Currently only know how to test subtract 1 from R0. | |
3 | 2 |
4 ; NOTE: We use -O2 to get rid of memory stores. | 3 ; NOTE: We use -O2 to get rid of memory stores. |
5 | 4 |
6 ; REQUIRES: allow_dump | 5 ; REQUIRES: allow_dump |
7 | 6 |
8 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 \ | 7 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 \ |
9 ; RUN: | FileCheck %s --check-prefix=ASM | 8 ; RUN: | FileCheck %s --check-prefix=ASM |
10 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \ | 9 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \ |
11 ; RUN: | FileCheck %s --check-prefix=IASM | 10 ; RUN: | FileCheck %s --check-prefix=IASM |
12 | 11 |
13 define internal i32 @sub1FromR0(i32 %p) { | 12 define internal i32 @sub1FromR0(i32 %p) { |
14 %v = sub i32 %p, 1 | 13 %v = sub i32 %p, 1 |
15 ret i32 %v | 14 ret i32 %v |
16 } | 15 } |
17 | 16 |
18 ; ASM-LABEL: sub1FromR0: | 17 ; ASM-LABEL: sub1FromR0: |
19 ; ASM: sub r0, r0, #1 | 18 ; ASM: sub r0, r0, #1 |
20 ; ASM: bx lr | 19 ; ASM: bx lr |
21 | 20 |
22 ; IASM-LABEL: sub1FromR0: | 21 ; IASM-LABEL: sub1FromR0: |
23 ; IASM: .byte 0x1 | 22 ; IASM: .byte 0x1 |
24 ; IASM-NEXT: .byte 0x0 | 23 ; IASM-NEXT: .byte 0x0 |
25 ; IASM-NEXT: .byte 0x40 | 24 ; IASM-NEXT: .byte 0x40 |
26 ; IASM-NEXT: .byte 0xe2 | 25 ; IASM-NEXT: .byte 0xe2 |
27 | 26 |
| 27 |
| 28 define internal i32 @Sub2Regs(i32 %p1, i32 %p2) { |
| 29 %v = sub i32 %p1, %p2 |
| 30 ret i32 %v |
| 31 } |
| 32 |
| 33 ; ASM-LABEL: Sub2Regs: |
| 34 ; ASM: sub r0, r0, r1 |
| 35 ; ASM-NEXT: bx lr |
| 36 |
| 37 ; IASM-LABEL: Sub2Regs: |
| 38 |
| 39 ; IASM: .byte 0x1 |
| 40 ; IASM-NEXT: .byte 0x0 |
| 41 ; IASM-NEXT: .byte 0x40 |
| 42 ; IASM-NEXT: .byte 0xe0 |
| 43 |
OLD | NEW |