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 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer | 3 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer |
4 ; doesn't know how to symbolize non-section-local functions. | 4 ; doesn't know how to symbolize non-section-local functions. |
5 ; The newer LLVM 3.6 one does work, but watch out for other bugs. | 5 ; The newer LLVM 3.6 one does work, but watch out for other bugs. |
6 | 6 |
7 ; RUN: %llvm2ice -O2 --verbose none %s \ | 7 ; RUN: %p2i -i %s -a -O2 --verbose none \ |
8 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s | 8 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s |
9 ; RUN: %llvm2ice -O2 --verbose none %s \ | 9 ; RUN: %p2i -i %s -a -O2 --verbose none \ |
10 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ | 10 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
11 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | 11 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
12 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 12 ; RUN: %p2i -i %s -a -Om1 --verbose none \ |
13 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ | 13 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
14 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | 14 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
15 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 15 ; RUN: %p2i -i %s -a --verbose none | FileCheck --check-prefix=ERRORS %s |
16 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 16 ; RUN: %p2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s |
17 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | |
18 ; RUN: | FileCheck --check-prefix=DUMP %s | |
19 | |
20 | 17 |
21 define internal i32 @divide(i32 %num, i32 %den) { | 18 define internal i32 @divide(i32 %num, i32 %den) { |
22 entry: | 19 entry: |
23 %cmp = icmp ne i32 %den, 0 | 20 %cmp = icmp ne i32 %den, 0 |
24 br i1 %cmp, label %return, label %abort | 21 br i1 %cmp, label %return, label %abort |
25 | 22 |
26 abort: ; preds = %entry | 23 abort: ; preds = %entry |
27 unreachable | 24 unreachable |
28 | 25 |
29 return: ; preds = %entry | 26 return: ; preds = %entry |
30 %div = sdiv i32 %num, %den | 27 %div = sdiv i32 %num, %den |
31 ret i32 %div | 28 ret i32 %div |
32 } | 29 } |
33 | 30 |
34 ; CHECK-LABEL: divide | 31 ; CHECK-LABEL: divide |
35 ; CALLTARGETS-LABEL: divide | 32 ; CALLTARGETS-LABEL: divide |
36 ; CHECK: cmp | 33 ; CHECK: cmp |
37 ; CHECK: call -4 | 34 ; CHECK: call -4 |
38 ; CALLTARGETS: call ice_unreachable | 35 ; CALLTARGETS: call ice_unreachable |
39 ; CHECK: cdq | 36 ; CHECK: cdq |
40 ; CHECK: idiv | 37 ; CHECK: idiv |
41 ; CHECK: ret | 38 ; CHECK: ret |
42 | 39 |
43 ; ERRORS-NOT: ICE translation error | 40 ; ERRORS-NOT: ICE translation error |
44 ; DUMP-NOT: SZ | 41 ; DUMP-NOT: SZ |
OLD | NEW |