OLD | NEW |
1 ; This tests the basic structure of the Unreachable instruction. | 1 ; This tests the basic structure of the Unreachable instruction. |
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 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
7 ; RUN: --target x8632 -i %s --args -Om1 \ | 7 ; RUN: --target x8632 -i %s --args -Om1 \ |
8 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
9 | 9 |
10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 10 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
11 ; RUN: --command %p2i --filetype=asm --assemble \ | 11 ; RUN: --command %p2i --filetype=asm --assemble \ |
12 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ | 12 ; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \ |
13 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 13 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
14 ; RUN: --command FileCheck --check-prefix ARM32 %s | 14 ; RUN: --command FileCheck --check-prefix ARM32 %s |
15 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 15 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
16 ; RUN: --command %p2i --filetype=asm --assemble \ | 16 ; RUN: --command %p2i --filetype=asm --assemble \ |
17 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ | 17 ; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \ |
18 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 18 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
19 ; RUN: --command FileCheck --check-prefix ARM32 %s | 19 ; RUN: --command FileCheck --check-prefix ARM32 %s |
20 | 20 |
| 21 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 22 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 23 ; RUN: --disassemble --target mips32 -i %s --args -Om1 --skip-unimplemented \ |
| 24 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 25 ; RUN: --command FileCheck --check-prefix MIPS32 %s |
| 26 |
| 27 ; RUN: %if --need=target_MIPS32 --need=allow_dump \ |
| 28 ; RUN: --command %p2i --filetype=asm --assemble \ |
| 29 ; RUN: --disassemble --target mips32 -i %s --args -O2 --skip-unimplemented \ |
| 30 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \ |
| 31 ; RUN: --command FileCheck --check-prefix MIPS32-O2 %s |
| 32 |
21 define internal i32 @divide(i32 %num, i32 %den) { | 33 define internal i32 @divide(i32 %num, i32 %den) { |
22 entry: | 34 entry: |
23 %cmp = icmp ne i32 %den, 0 | 35 %cmp = icmp ne i32 %den, 0 |
24 br i1 %cmp, label %return, label %abort | 36 br i1 %cmp, label %return, label %abort |
25 | 37 |
26 abort: ; preds = %entry | 38 abort: ; preds = %entry |
27 unreachable | 39 unreachable |
28 | 40 |
29 return: ; preds = %entry | 41 return: ; preds = %entry |
30 %div = sdiv i32 %num, %den | 42 %div = sdiv i32 %num, %den |
31 ret i32 %div | 43 ret i32 %div |
32 } | 44 } |
33 | 45 |
34 ; CHECK-LABEL: divide | 46 ; CHECK-LABEL: divide |
35 ; CHECK: cmp | 47 ; CHECK: cmp |
36 ; CHECK: ud2 | 48 ; CHECK: ud2 |
37 ; CHECK: cdq | 49 ; CHECK: cdq |
38 ; CHECK: idiv | 50 ; CHECK: idiv |
39 ; CHECK: ret | 51 ; CHECK: ret |
40 | 52 |
41 ; ARM32-LABEL: divide | 53 ; ARM32-LABEL: divide |
42 ; ARM32: tst | 54 ; ARM32: tst |
43 ; ARM32: .word 0xe7fedef0 | 55 ; ARM32: .word 0xe7fedef0 |
44 ; ARM32: bl {{.*}} __divsi3 | 56 ; ARM32: bl {{.*}} __divsi3 |
45 ; ARM32: bx lr | 57 ; ARM32: bx lr |
| 58 |
| 59 ; MIPS32-LABEL: divide |
| 60 ; MIPS32: beqz |
| 61 ; MIPS32: nop |
| 62 ; MIPS32: teq zero,zero |
| 63 ; MIPS32: jal {{.*}} __divsi3 |
| 64 |
| 65 ; MIPS32-O2-LABEL: divide |
| 66 ; MIPS32-O2: bne |
| 67 ; MIPS32-O2: nop |
| 68 ; MIPS32-O2: teq zero,zero |
| 69 ; MIPS32-O2: jal {{.*}} __divsi3 |
OLD | NEW |