1 ; RUN: llc -mtriple=thumb-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s
3 ; These tests would be improved by 'movs r0, #0' being rematerialized below the
4 ; test as 'mov.w r0, #0'.
7 define i32 @f1(i32 %a) {
9 ; CHECK: cmp {{.*}}, #187
10 %tmp = icmp ne i32 %a, 187
11 %ret = select i1 %tmp, i32 42, i32 24
15 ; 0x00aa00aa = 11141290
16 define i32 @f2(i32 %a) {
18 ; CHECK: cmp.w {{.*}}, #11141290
19 %tmp = icmp eq i32 %a, 11141290
20 %ret = select i1 %tmp, i32 42, i32 24
24 ; 0xcc00cc00 = 3422604288
25 define i32 @f3(i32 %a) {
27 ; CHECK: cmp.w {{.*}}, #-872363008
28 %tmp = icmp ne i32 %a, 3422604288
29 %ret = select i1 %tmp, i32 42, i32 24
33 ; 0xdddddddd = 3722304989
34 define i32 @f4(i32 %a) {
36 ; CHECK: cmp.w {{.*}}, #-572662307
37 %tmp = icmp ne i32 %a, 3722304989
38 %ret = select i1 %tmp, i32 42, i32 24
42 ; 0x00110000 = 1114112
43 define i32 @f5(i32 %a) {
45 ; CHECK: cmp.w {{.*}}, #1114112
46 %tmp = icmp eq i32 %a, 1114112
47 %ret = select i1 %tmp, i32 42, i32 24
51 ; Check that we don't do an invalid (a > b) --> !(a < b + 1) transform.
54 ; CHECK-NOT: cmp.w {{.*}}, #-2147483648
56 define i32 @f6(i32 %a) {
57 %tmp = icmp sgt i32 %a, 2147483647
58 br i1 %tmp, label %true, label %false
65 define i32 @slt_poweroftwo(i32 %a) {
66 ; CHECK-LABEL: slt_poweroftwo:
67 ; CHECK: cmp.w r0, #4096
68 %b = icmp slt i32 %a, 4096
69 br i1 %b, label %true, label %false
78 define i32 @sle_poweroftwo(i32 %a) {
79 ; CHECK-LABEL: sle_poweroftwo:
80 ; CHECK: cmp.w r0, #4096
81 %b = icmp sle i32 %a, 4096
82 br i1 %b, label %true, label %false
91 define i32 @sge_poweroftwo(i32 %a) {
92 ; CHECK-LABEL: sge_poweroftwo:
93 ; CHECK: cmp.w r0, #4096
94 %b = icmp sge i32 %a, 4096
95 br i1 %b, label %true, label %false
104 define i32 @sgt_poweroftwo(i32 %a) {
105 ; CHECK-LABEL: sgt_poweroftwo:
106 ; CHECK: cmp.w r0, #4096
107 %b = icmp sgt i32 %a, 4096
108 br i1 %b, label %true, label %false
117 define i32 @slt_nearpoweroftwo(i32 %a) {
118 ; CHECK-LABEL: slt_nearpoweroftwo:
119 ; CHECK: cmp.w r0, #4096
120 %b = icmp slt i32 %a, 4097
121 br i1 %b, label %true, label %false
130 define i32 @sle_nearpoweroftwo(i32 %a) {
131 ; CHECK-LABEL: sle_nearpoweroftwo:
132 ; CHECK: cmp.w r0, #4096
133 %b = icmp sle i32 %a, 4095
134 br i1 %b, label %true, label %false
144 define i32 @sge_nearpoweroftwo(i32 %a) {
145 ; CHECK-LABEL: sge_nearpoweroftwo:
146 ; CHECK: cmp.w r0, #4096
147 %b = icmp sge i32 %a, 4097
148 br i1 %b, label %true, label %false
157 define i32 @sgt_nearpoweroftwo(i32 %a) {
158 ; CHECK-LABEL: sgt_nearpoweroftwo:
159 ; CHECK: cmp.w r0, #4096
160 %b = icmp sgt i32 %a, 4095
161 br i1 %b, label %true, label %false
170 define i32 @slt_neg_soimm(i32 %a) {
171 ; CHECK-LABEL: slt_neg_soimm:
172 ; CHECK: cmn.w r0, #7929856
173 %b = icmp slt i32 %a, -7929856
174 br i1 %b, label %true, label %false
183 define i32 @sle_neg_soimm(i32 %a) {
184 ; CHECK-LABEL: sle_neg_soimm:
185 ; CHECK: cmn.w r0, #7929856
186 %b = icmp sle i32 %a, -7929856
187 br i1 %b, label %true, label %false
196 define i32 @sge_neg_soimm(i32 %a) {
197 ; CHECK-LABEL: sge_neg_soimm:
198 ; CHECK: cmn.w r0, #7929856
199 %b = icmp sge i32 %a, -7929856
200 br i1 %b, label %true, label %false
209 define i32 @sgt_neg_soimm(i32 %a) {
210 ; CHECK-LABEL: sgt_neg_soimm:
211 ; CHECK: cmn.w r0, #7929856
212 %b = icmp sgt i32 %a, -7929856
213 br i1 %b, label %true, label %false
222 define i32 @slt_notneg_soimm(i32 %a) {
223 ; CHECK-LABEL: slt_notneg_soimm:
224 ; CHECK: cmp.w r0, #-2013231104
225 %b = icmp slt i32 %a, -2013231104
226 br i1 %b, label %true, label %false
235 define i32 @sle_notneg_soimm(i32 %a) {
236 ; CHECK-LABEL: sle_notneg_soimm:
237 ; CHECK: cmp.w r0, #-2013231104
238 %b = icmp sle i32 %a, -2013231104
239 br i1 %b, label %true, label %false
248 define i32 @sge_notneg_soimm(i32 %a) {
249 ; CHECK-LABEL: sge_notneg_soimm:
250 ; CHECK: cmp.w r0, #-2013231104
251 %b = icmp sge i32 %a, -2013231104
252 br i1 %b, label %true, label %false
261 define i32 @sgt_notneg_soimm(i32 %a) {
262 ; CHECK-LABEL: sgt_notneg_soimm:
263 ; CHECK: cmp.w r0, #-2013231104
264 %b = icmp sgt i32 %a, -2013231104
265 br i1 %b, label %true, label %false
274 define i32 @sgt_movw(i32 %a) {
275 ; CHECK-LABEL: sgt_movw:
276 ; CHECK: movw r1, #2167
277 %b = icmp sgt i32 %a, 2166
278 br i1 %b, label %true, label %false
287 define i32 @sgt_neg_movw(i32 %a) {
288 ; CHECK-LABEL: sgt_neg_movw:
289 ; CHECK: movw r1, #63371
290 ; CHECK: movt r1, #65535
291 %b = icmp sgt i32 %a, -2166
292 br i1 %b, label %true, label %false