• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -O2 -mtriple armv7a < %s | FileCheck --check-prefix=ARM %s
2
3; RUN: llc -O2 -mtriple thumbv6m < %s | FileCheck --check-prefix=THUMB1 %s
4; RUN: llc -O2 -mtriple thumbv8m.base < %s | FileCheck --check-prefix=THUMB1 %s
5
6; RUN: llc -O2 -mtriple thumbv7a < %s | FileCheck --check-prefix=THUMB %s
7; RUN: llc -O2 -mtriple thumbv8m.main < %s | FileCheck --check-prefix=THUMB %s
8
9define void @fn1(i32 %a, i32 %b, i32 %c) local_unnamed_addr #0 {
10entry:
11
12; ARM: rsb	r2, r2, #1
13; ARM: adds	r0, r1, r0
14; ARM: movw	r1, #65535
15; ARM: sxth	r2, r2
16; ARM: adc	r0, r2, #0
17; ARM: tst	r0, r1
18; ARM: bxeq	lr
19; ARM: .LBB0_1:
20; ARM: b	.LBB0_1
21
22; THUMB1: movs	r3, #1
23; THUMB1: subs	r2, r3, r2
24; THUMB1: sxth	r2, r2
25; THUMB1: movs	r3, #0
26; THUMB1: adds	r0, r1, r0
27; THUMB1: adcs	r3, r2
28; THUMB1: lsls	r0, r3, #16
29; THUMB1: beq	.LBB0_2
30; THUMB1: .LBB0_1:
31; THUMB1: b	.LBB0_1
32
33; THUMB: rsb.w	r2, r2, #1
34; THUMB: adds	r0, r0, r1
35; THUMB: sxth	r2, r2
36; THUMB: adc	r0, r2, #0
37; THUMB: lsls	r0, r0, #16
38; THUMB: it	eq
39; THUMB: bxeq	lr
40; THUMB: .LBB0_1:
41; THUMB: b	.LBB0_1
42
43  %add = add i32 %b, %a
44  %cmp = icmp ult i32 %add, %b
45  %conv = zext i1 %cmp to i32
46  %sub = sub i32 1, %c
47  %add1 = add i32 %sub, %conv
48  %conv2 = trunc i32 %add1 to i16
49  %tobool = icmp eq i16 %conv2, 0
50  br i1 %tobool, label %if.end, label %for.cond.preheader
51
52for.cond.preheader:                               ; preds = %entry
53  br label %for.cond
54
55for.cond:                                         ; preds = %for.cond.preheader, %for.cond
56  br label %for.cond
57
58if.end:                                           ; preds = %entry
59  ret void
60}
61