1; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s
2
3; These tests would be improved by 'movs r0, #0' being rematerialized below the
4; test as 'mov.w r0, #0'.
5
6; 0x000000bb = 187
7define i1 @f1(i32 %a) {
8; CHECK-LABEL: f1:
9; CHECK: cmp {{.*}}, #187
10    %tmp = icmp ne i32 %a, 187
11    ret i1 %tmp
12}
13
14; 0x00aa00aa = 11141290
15define i1 @f2(i32 %a) {
16; CHECK-LABEL: f2:
17; CHECK: cmp.w {{.*}}, #11141290
18    %tmp = icmp eq i32 %a, 11141290
19    ret i1 %tmp
20}
21
22; 0xcc00cc00 = 3422604288
23define i1 @f3(i32 %a) {
24; CHECK-LABEL: f3:
25; CHECK: cmp.w {{.*}}, #-872363008
26    %tmp = icmp ne i32 %a, 3422604288
27    ret i1 %tmp
28}
29
30; 0xdddddddd = 3722304989
31define i1 @f4(i32 %a) {
32; CHECK-LABEL: f4:
33; CHECK: cmp.w {{.*}}, #-572662307
34    %tmp = icmp ne i32 %a, 3722304989
35    ret i1 %tmp
36}
37
38; 0x00110000 = 1114112
39define i1 @f5(i32 %a) {
40; CHECK-LABEL: f5:
41; CHECK: cmp.w {{.*}}, #1114112
42    %tmp = icmp eq i32 %a, 1114112
43    ret i1 %tmp
44}
45
46; Check that we don't do an invalid (a > b) --> !(a < b + 1) transform.
47;
48; CHECK-LABEL: f6:
49; CHECK-NOT: cmp.w {{.*}}, #-2147483648
50; CHECK: bx lr
51define i32 @f6(i32 %a) {
52    %tmp = icmp sgt i32 %a, 2147483647
53    br i1 %tmp, label %true, label %false
54true:
55    ret i32 2
56false:
57    ret i32 0
58}
59