| OLD | NEW |
| 1 ; Show that we can translate IR instruction "trap". | 1 ; Show that we can translate IR instruction "trap". |
| 2 | 2 |
| 3 ; Note: We use integer division to test this, since a trap is inserted | |
| 4 ; if one divides by zero. | |
| 5 | |
| 6 ; REQUIRES: allow_dump | 3 ; REQUIRES: allow_dump |
| 7 | 4 |
| 8 ; Compile using standalone assembler. | 5 ; Compile using standalone assembler. |
| 9 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -Om1 \ | 6 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -Om1 \ |
| 10 ; RUN: | FileCheck %s --check-prefix=ASM | 7 ; RUN: | FileCheck %s --check-prefix=ASM |
| 11 | 8 |
| 12 ; Show bytes in assembled standalone code. | 9 ; Show bytes in assembled standalone code. |
| 13 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \ | 10 ; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \ |
| 14 ; RUN: --args -Om1 \ | 11 ; RUN: --args -Om1 \ |
| 15 ; RUN: | FileCheck %s --check-prefix=DIS | 12 ; RUN: | FileCheck %s --check-prefix=DIS |
| 16 | 13 |
| 17 ; Compile using integrated assembler. | 14 ; Compile using integrated assembler. |
| 18 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \ | 15 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \ |
| 19 ; RUN: | FileCheck %s --check-prefix=IASM | 16 ; RUN: | FileCheck %s --check-prefix=IASM |
| 20 | 17 |
| 21 ; Show bytes in assembled integrated code. | 18 ; Show bytes in assembled integrated code. |
| 22 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \ | 19 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \ |
| 23 ; RUN: --args -Om1 \ | 20 ; RUN: --args -Om1 \ |
| 24 ; RUN: | FileCheck %s --check-prefix=DIS | 21 ; RUN: | FileCheck %s --check-prefix=DIS |
| 25 | 22 |
| 23 ; testUnreachable generates a trap for the unreachable instruction. |
| 24 |
| 25 define internal void @testUnreachable() { |
| 26 ; ASM-LABEL: testUnreachable: |
| 27 ; DIS-LABEL: 00000000 <testUnreachable>: |
| 28 |
| 29 unreachable |
| 30 |
| 31 ; ASM: .long 0xe7fedef0 |
| 32 ; DIS-NEXT: 0: e7fedef0 |
| 33 ; IASM-NOT: .long 0xe7fedef0 |
| 34 } |
| 35 |
| 36 ; testTrap uses integer division to test this, since a trap is |
| 37 ; inserted if one divides by zero. |
| 38 |
| 26 define internal i32 @testTrap(i32 %v1, i32 %v2) { | 39 define internal i32 @testTrap(i32 %v1, i32 %v2) { |
| 27 ; ASM-LABEL: testTrap: | 40 ; ASM-LABEL: testTrap: |
| 28 ; DIS-LABEL: 00000000 <testTrap>: | 41 ; DIS-LABEL: 00000010 <testTrap>: |
| 29 ; IASM-LABEL: testTrap: | 42 ; IASM-LABEL: testTrap: |
| 30 | 43 |
| 31 %res = udiv i32 %v1, %v2 | 44 %res = udiv i32 %v1, %v2 |
| 32 | 45 |
| 33 ; ASM: bne | 46 ; ASM: bne |
| 34 ; DIS: 18:» 1a000000 | 47 ; DIS: 28: 1a000000 |
| 35 ; IASM-NOT: bne | 48 ; IASM-NOT: bne |
| 36 | 49 |
| 37 ; ASM-NEXT: .long 0xe7fedef0 | 50 ; ASM-NEXT: .long 0xe7fedef0 |
| 38 ; DIS-NEXT: 1c:» e7fedef0 | 51 ; DIS-NEXT: 2c: e7fedef0 |
| 39 ; IASM-NOT: .long | 52 ; IASM-NOT: .long 0xe7fedef0 |
| 40 | 53 |
| 41 ret i32 %res | 54 ret i32 %res |
| 42 } | 55 } |
| OLD | NEW |