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: %p2i -i %s -a -O2 --verbose none \ | 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: %p2i -i %s -a -O2 --verbose none \ | 9 ; RUN: %p2i -i %s -a -O2 --verbose none \ |
10 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 10 ; RUN: | llvm-mc -triple=i686-none-nacl -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: %p2i -i %s -a -Om1 --verbose none \ | 12 ; RUN: %p2i -i %s -a -Om1 --verbose none \ |
13 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 13 ; RUN: | llvm-mc -triple=i686-none-nacl -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: %p2i -i %s -a --verbose none | FileCheck --check-prefix=ERRORS %s | |
16 ; RUN: %p2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s | |
17 | 15 |
18 define internal i32 @divide(i32 %num, i32 %den) { | 16 define internal i32 @divide(i32 %num, i32 %den) { |
19 entry: | 17 entry: |
20 %cmp = icmp ne i32 %den, 0 | 18 %cmp = icmp ne i32 %den, 0 |
21 br i1 %cmp, label %return, label %abort | 19 br i1 %cmp, label %return, label %abort |
22 | 20 |
23 abort: ; preds = %entry | 21 abort: ; preds = %entry |
24 unreachable | 22 unreachable |
25 | 23 |
26 return: ; preds = %entry | 24 return: ; preds = %entry |
27 %div = sdiv i32 %num, %den | 25 %div = sdiv i32 %num, %den |
28 ret i32 %div | 26 ret i32 %div |
29 } | 27 } |
30 | 28 |
31 ; CHECK-LABEL: divide | 29 ; CHECK-LABEL: divide |
32 ; CALLTARGETS-LABEL: divide | 30 ; CALLTARGETS-LABEL: divide |
33 ; CHECK: cmp | 31 ; CHECK: cmp |
34 ; CHECK: call -4 | 32 ; CHECK: call -4 |
35 ; CALLTARGETS: call ice_unreachable | 33 ; CALLTARGETS: call ice_unreachable |
36 ; CHECK: cdq | 34 ; CHECK: cdq |
37 ; CHECK: idiv | 35 ; CHECK: idiv |
38 ; CHECK: ret | 36 ; CHECK: ret |
39 | |
40 ; ERRORS-NOT: ICE translation error | |
41 ; DUMP-NOT: SZ | |
OLD | NEW |