1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple thumbv7-eabi | FileCheck %s -check-prefix=T2
3; RUN: llc < %s -mtriple thumbv6m-eabi | FileCheck %s -check-prefix=T1
4; <rdar://problem/7569620>
5
6define i32 @compare_i_gt(i32 %a) {
7; T2-LABEL: compare_i_gt:
8; T2:       @ %bb.0: @ %entry
9; T2-NEXT:    movs r1, #24
10; T2-NEXT:    cmn.w r0, #78
11; T2-NEXT:    it gt
12; T2-NEXT:    movgt r1, #42
13; T2-NEXT:    mov r0, r1
14; T2-NEXT:    bx lr
15;
16; T1-LABEL: compare_i_gt:
17; T1:       @ %bb.0: @ %entry
18; T1-NEXT:    movs r1, #77
19; T1-NEXT:    mvns r1, r1
20; T1-NEXT:    cmp r0, r1
21; T1-NEXT:    bgt .LBB0_2
22; T1-NEXT:  @ %bb.1: @ %entry
23; T1-NEXT:    movs r0, #24
24; T1-NEXT:    bx lr
25; T1-NEXT:  .LBB0_2:
26; T1-NEXT:    movs r0, #42
27; T1-NEXT:    bx lr
28entry:
29  %cmp = icmp sgt i32 %a, -78
30  %ret = select i1 %cmp, i32 42, i32 24
31  ret i32 %ret
32}
33
34define i32 @compare_r_eq(i32 %a, i32 %b) {
35; T2-LABEL: compare_r_eq:
36; T2:       @ %bb.0: @ %entry
37; T2-NEXT:    movs r2, #24
38; T2-NEXT:    cmn r0, r1
39; T2-NEXT:    it eq
40; T2-NEXT:    moveq r2, #42
41; T2-NEXT:    mov r0, r2
42; T2-NEXT:    bx lr
43;
44; T1-LABEL: compare_r_eq:
45; T1:       @ %bb.0: @ %entry
46; T1-NEXT:    cmn r0, r1
47; T1-NEXT:    beq .LBB1_2
48; T1-NEXT:  @ %bb.1: @ %entry
49; T1-NEXT:    movs r0, #24
50; T1-NEXT:    bx lr
51; T1-NEXT:  .LBB1_2:
52; T1-NEXT:    movs r0, #42
53; T1-NEXT:    bx lr
54entry:
55  %sub = sub nsw i32 0, %b
56  %cmp = icmp eq i32 %a, %sub
57  %ret = select i1 %cmp, i32 42, i32 24
58  ret i32 %ret
59}
60