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: %p2i -i %s --assemble --disassemble -a -O2 --verbose none \ | 3 ; RUN: %p2i -i %s --assemble --disassemble -a -O2 --verbose none \ |
4 ; RUN: | FileCheck %s | 4 ; RUN: | FileCheck %s |
5 ; RUN: %p2i -i %s --assemble --disassemble -a -Om1 --verbose none \ | 5 ; RUN: %p2i -i %s --assemble --disassemble -a -Om1 --verbose none \ |
6 ; RUN: | FileCheck %s | 6 ; RUN: | FileCheck %s |
7 | 7 |
8 define internal i32 @divide(i32 %num, i32 %den) { | 8 define internal i32 @divide(i32 %num, i32 %den) { |
9 entry: | 9 entry: |
10 %cmp = icmp ne i32 %den, 0 | 10 %cmp = icmp ne i32 %den, 0 |
11 br i1 %cmp, label %return, label %abort | 11 br i1 %cmp, label %return, label %abort |
12 | 12 |
13 abort: ; preds = %entry | 13 abort: ; preds = %entry |
14 unreachable | 14 unreachable |
15 | 15 |
16 return: ; preds = %entry | 16 return: ; preds = %entry |
17 %div = sdiv i32 %num, %den | 17 %div = sdiv i32 %num, %den |
18 ret i32 %div | 18 ret i32 %div |
19 } | 19 } |
20 | 20 |
21 ; CHECK-LABEL: divide | 21 ; CHECK-LABEL: divide |
22 ; CHECK: cmp | 22 ; CHECK: cmp |
23 ; CHECK: call {{.*}} R_{{.*}} ice_unreachable | 23 ; CHECK: ud2 |
24 ; CHECK: cdq | 24 ; CHECK: cdq |
25 ; CHECK: idiv | 25 ; CHECK: idiv |
26 ; CHECK: ret | 26 ; CHECK: ret |
OLD | NEW |