1 ; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s
3 define i32 @f(i32 %a, i32 %b) nounwind ssp {
8 %cmp = icmp sgt i32 %a, %b
9 %sub = sub nsw i32 %a, %b
10 %sub. = select i1 %cmp, i32 %sub, i32 0
14 define i32 @g(i32 %a, i32 %b) nounwind ssp {
19 %cmp = icmp slt i32 %a, %b
20 %sub = sub nsw i32 %b, %a
21 %sub. = select i1 %cmp, i32 %sub, i32 0
25 define i32 @h(i32 %a, i32 %b) nounwind ssp {
30 %cmp = icmp sgt i32 %a, 3
31 %sub = sub nsw i32 %a, 3
32 %sub. = select i1 %cmp, i32 %sub, i32 %b
37 define i32 @i(i32 %a, i32 %b) nounwind readnone ssp {
42 %cmp = icmp ult i32 %a, %b
44 %sub. = select i1 %cmp, i32 %sub, i32 0
47 ; If CPSR is live-out, we can't remove cmp if there exists
49 define i32 @j(i32 %a, i32 %b) nounwind {
54 %cmp = icmp eq i32 %b, %a
55 %sub = sub nsw i32 %a, %b
56 br i1 %cmp, label %if.then, label %if.else
59 %cmp2 = icmp sgt i32 %b, %a
60 %sel = select i1 %cmp2, i32 %sub, i32 %a