1 ; RUN: llc < %s -march=avr | FileCheck %s
2 ; RUN: llc < %s -mtriple=avr -mcpu=attiny10 | FileCheck --check-prefix=TINY %s
6 define void @cmp8(i8 %a, i8 %b) {
10 %cmp = icmp eq i8 %a, %b
11 br i1 %cmp, label %if.then, label %if.else
13 tail call void @f1(i8 %a)
16 tail call void @f2(i8 %b)
24 define void @cmp16(i16 %a, i16 %b) {
28 %cmp = icmp eq i16 %a, %b
29 br i1 %cmp, label %if.then, label %if.else
31 tail call void @f3(i16 %a)
34 tail call void @f4(i16 %b)
40 define void @cmpimm16(i16 %a) {
41 ; CHECK-LABEL: cmpimm16:
44 %cmp = icmp eq i16 %a, 4567
45 br i1 %cmp, label %if.then, label %if.else
47 tail call void @f3(i16 %a)
50 tail call void @f4(i16 %a)
58 define void @cmp32(i32 %a, i32 %b) {
64 %cmp = icmp eq i32 %a, %b
65 br i1 %cmp, label %if.then, label %if.else
67 tail call void @f5(i32 %a)
70 tail call void @f6(i32 %b)
76 define void @cmpimm32(i32 %a) {
77 ; CHECK-LABEL: cmpimm32:
82 %cmp = icmp eq i32 %a, 6789343
83 br i1 %cmp, label %if.then, label %if.else
85 tail call void @f5(i32 %a)
88 tail call void @f6(i32 %a)
96 define void @cmp64(i64 %a, i64 %b) {
106 %cmp = icmp eq i64 %a, %b
107 br i1 %cmp, label %if.then, label %if.else
109 tail call void @f7(i64 %a)
112 tail call void @f8(i64 %b)
118 define void @cmpimm64(i64 %a) {
119 ; CHECK-LABEL: cmpimm64:
128 %cmp = icmp eq i64 %a, 234566452
129 br i1 %cmp, label %if.then, label %if.else
131 tail call void @f7(i64 %a)
134 tail call void @f8(i64 %a)
143 define void @tst8(i8 %a) {
147 %cmp = icmp sgt i8 %a, -1
148 br i1 %cmp, label %if.then, label %if.else
153 tail call void @f10()
159 define void @tst16(i16 %a) {
160 ; CHECK-LABEL: tst16:
163 %cmp = icmp sgt i16 %a, -1
164 br i1 %cmp, label %if.then, label %if.else
169 tail call void @f10()
175 define void @tst32(i32 %a) {
176 ; CHECK-LABEL: tst32:
179 %cmp = icmp sgt i32 %a, -1
180 br i1 %cmp, label %if.then, label %if.else
185 tail call void @f10()
191 define void @tst64(i64 %a) {
192 ; CHECK-LABEL: tst64:
195 %cmp = icmp sgt i64 %a, -1
196 br i1 %cmp, label %if.then, label %if.else
201 tail call void @f10()
207 define i16 @cmp_i16_gt_0(i16 %0) {
208 ; CHECK-LABEL: cmp_i16_gt_0:
210 ; CHECK-NEXT: ldi r18, 1
211 ; CHECK-NEXT: cp r1, r24
212 ; CHECK-NEXT: cpc r1, r25
213 ; CHECK-NEXT: brlt .LBB11_2
214 ; CHECK-NEXT: ; %bb.1:
215 ; CHECK-NEXT: mov r18, r1
216 ; CHECK-NEXT: .LBB11_2:
217 ; CHECK-NEXT: mov r24, r18
218 ; CHECK-NEXT: clr r25
221 ; TINY-LABEL: cmp_i16_gt_0:
223 ; TINY-NEXT: ldi r20, 1
224 ; TINY-NEXT: cp r17, r24
225 ; TINY-NEXT: cpc r17, r25
226 ; TINY-NEXT: brlt .LBB11_2
227 ; TINY-NEXT: ; %bb.1:
228 ; TINY-NEXT: mov r20, r17
229 ; TINY-NEXT: .LBB11_2:
230 ; TINY-NEXT: mov r24, r20
233 %2 = icmp sgt i16 %0, 0
234 %3 = zext i1 %2 to i16
238 define i16 @cmp_i16_gt_126(i16 %0) {
239 ; CHECK-LABEL: cmp_i16_gt_126:
241 ; CHECK-NEXT: ldi r18, 1
242 ; CHECK-NEXT: cpi r24, 127
243 ; CHECK-NEXT: cpc r25, r1
244 ; CHECK-NEXT: brge .LBB12_2
245 ; CHECK-NEXT: ; %bb.1:
246 ; CHECK-NEXT: mov r18, r1
247 ; CHECK-NEXT: .LBB12_2:
248 ; CHECK-NEXT: mov r24, r18
249 ; CHECK-NEXT: clr r25
252 ; TINY-LABEL: cmp_i16_gt_126:
254 ; TINY-NEXT: ldi r20, 1
255 ; TINY-NEXT: cpi r24, 127
256 ; TINY-NEXT: cpc r25, r17
257 ; TINY-NEXT: brge .LBB12_2
258 ; TINY-NEXT: ; %bb.1:
259 ; TINY-NEXT: mov r20, r17
260 ; TINY-NEXT: .LBB12_2:
261 ; TINY-NEXT: mov r24, r20
264 %2 = icmp sgt i16 %0, 126
265 %3 = zext i1 %2 to i16
269 define i16 @cmp_i16_gt_1023(i16 %0) {
270 ; CHECK-LABEL: cmp_i16_gt_1023:
272 ; CHECK-NEXT: ldi r19, 4
273 ; CHECK-NEXT: ldi r18, 1
274 ; CHECK-NEXT: cp r24, r1
275 ; CHECK-NEXT: cpc r25, r19
276 ; CHECK-NEXT: brge .LBB13_2
277 ; CHECK-NEXT: ; %bb.1:
278 ; CHECK-NEXT: mov r18, r1
279 ; CHECK-NEXT: .LBB13_2:
280 ; CHECK-NEXT: mov r24, r18
281 ; CHECK-NEXT: clr r25
284 ; TINY-LABEL: cmp_i16_gt_1023:
286 ; TINY-NEXT: ldi r21, 4
287 ; TINY-NEXT: ldi r20, 1
288 ; TINY-NEXT: cp r24, r17
289 ; TINY-NEXT: cpc r25, r21
290 ; TINY-NEXT: brge .LBB13_2
291 ; TINY-NEXT: ; %bb.1:
292 ; TINY-NEXT: mov r20, r17
293 ; TINY-NEXT: .LBB13_2:
294 ; TINY-NEXT: mov r24, r20
297 %2 = icmp sgt i16 %0, 1023
298 %3 = zext i1 %2 to i16