1; RUN: llc -mtriple=armv7-unknown-linux < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-ARM %s
2; RUN: llc -mtriple=thumbv6-unknown-linux < %s | FileCheck --check-prefix=CHECK-THUMB1 %s
3; RUN: llc -mtriple=thumbv7-unknown-linux < %s | FileCheck --check-prefix=CHECK --check-prefix=CHECK-THUMB2 %s
4
5; CHECK-THUMB1-NOT: sbc
6
7; CHECK-LABEL: test_slt1:
8define i32 @test_slt1(i64 %a, i64 %b) {
9entry:
10  ; CHECK-ARM: subs {{[^,]+}}, r0, r2
11  ; CHECK-ARM: mov [[TMP:[0-9a-z]+]], #2
12  ; CHECK-ARM: sbcs {{[^,]+}}, r1, r3
13  ; CHECK-ARM: movwlt [[TMP]], #1
14  ; CHECK-ARM: mov r0, [[TMP]]
15  ; CHECK-ARM: bx lr
16  ; CHECK-THUMB2: subs {{[^,]+}}, r0, r2
17  ; CHECK-THUMB2: mov.w [[TMP:[0-9a-z]+]], #2
18  ; CHECK-THUMB2: sbcs.w {{[^,]+}}, r1, r3
19  ; CHECK-THUMB2: it lt
20  ; CHECK-THUMB2: movlt.w [[TMP]], #1
21  ; CHECK-THUMB2: mov r0, [[TMP]]
22  ; CHECK-THUMB2: bx lr
23  %cmp = icmp slt i64 %a, %b
24  br i1 %cmp, label %bb1, label %bb2
25bb1:
26  ret i32 1
27bb2:
28  ret i32 2
29}
30
31; CHECK-LABEL: test_slt2:
32define void @test_slt2(i64 %a, i64 %b) {
33entry:
34  %cmp = icmp slt i64 %a, %b
35  ; CHECK-ARM: subs {{[^,]+}}, r0, r2
36  ; CHECK-ARM: sbcs {{[^,]+}}, r1, r3
37  ; CHECK-THUMB2: subs {{[^,]+}}, r0, r2
38  ; CHECK-THUMB2: sbcs.w {{[^,]+}}, r1, r3
39  ; CHECK: bge [[BB2:\.[0-9A-Za-z_]+]]
40  br i1 %cmp, label %bb1, label %bb2
41bb1:
42  call void @f()
43  ret void
44bb2:
45  ; CHECK: [[BB2]]:
46  ; CHECK-NEXT: bl g
47  call void @g()
48  ret void
49}
50
51declare void @f()
52declare void @g()
53