blob: 383c9be11252dca1e9d97231d5d8b7c6c00541ee [file] [log] [blame]
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -07001; This tests the basic structure of the Unreachable instruction.
2
Jan Voung6ec369e2015-06-30 11:03:15 -07003; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
4; RUN: --target x8632 -i %s --args -O2 \
5; RUN: | %if --need=target_X8632 --command FileCheck %s
6; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \
7; RUN: --target x8632 -i %s --args -Om1 \
8; RUN: | %if --need=target_X8632 --command FileCheck %s
9
10; RUN: %if --need=target_ARM32 --need=allow_dump \
11; RUN: --command %p2i --filetype=asm --assemble \
12; RUN: --disassemble --target arm32 -i %s --args -O2 --skip-unimplemented \
13; RUN: | %if --need=target_ARM32 --need=allow_dump \
14; RUN: --command FileCheck --check-prefix ARM32 %s
Jan Voung70fa5252015-07-06 14:01:25 -070015; RUN: %if --need=target_ARM32 --need=allow_dump \
16; RUN: --command %p2i --filetype=asm --assemble \
17; RUN: --disassemble --target arm32 -i %s --args -Om1 --skip-unimplemented \
18; RUN: | %if --need=target_ARM32 --need=allow_dump \
19; RUN: --command FileCheck --check-prefix ARM32 %s
Jan Voungdddc3062014-08-29 12:59:02 -070020
Jim Stichnothf7c9a142014-04-29 10:52:43 -070021define internal i32 @divide(i32 %num, i32 %den) {
22entry:
23 %cmp = icmp ne i32 %den, 0
24 br i1 %cmp, label %return, label %abort
25
26abort: ; preds = %entry
27 unreachable
Jim Stichnothf7c9a142014-04-29 10:52:43 -070028
29return: ; preds = %entry
30 %div = sdiv i32 %num, %den
31 ret i32 %div
32}
33
Jan Voungdddc3062014-08-29 12:59:02 -070034; CHECK-LABEL: divide
Jim Stichnothd97c7df2014-06-04 11:57:08 -070035; CHECK: cmp
Jim Stichnothc53f7a62015-02-20 11:43:41 -080036; CHECK: ud2
Jim Stichnothd97c7df2014-06-04 11:57:08 -070037; CHECK: cdq
38; CHECK: idiv
39; CHECK: ret
Jan Voung6ec369e2015-06-30 11:03:15 -070040
41; ARM32-LABEL: divide
42; ARM32: cmp
43; ARM32: .word 0xe7fedef0
44; ARM32: bl {{.*}} __divsi3
45; ARM32: bx lr