1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O2 -mtriple armv7a < %s | FileCheck --check-prefixes=ARM %s
4 ; RUN: llc -O2 -mtriple thumbv6m < %s | FileCheck --check-prefixes=THUMBV6M %s
5 ; RUN: llc -O2 -mtriple thumbv8m.base < %s | FileCheck --check-prefixes=THUMBV8M-BASE %s
7 ; RUN: llc -O2 -mtriple thumbv7a < %s | FileCheck --check-prefixes=THUMB %s
8 ; RUN: llc -O2 -mtriple thumbv8m.main < %s | FileCheck --check-prefixes=THUMB %s
10 define void @fn1(i32 %a, i32 %b, i32 %c) local_unnamed_addr #0 {
12 ; ARM: @ %bb.0: @ %entry
13 ; ARM-NEXT: rsb r2, r2, #0
14 ; ARM-NEXT: adds r0, r1, r0
15 ; ARM-NEXT: movw r1, #65535
16 ; ARM-NEXT: sxth r2, r2
17 ; ARM-NEXT: adc r0, r2, #1
18 ; ARM-NEXT: tst r0, r1
20 ; ARM-NEXT: .LBB0_1: @ %for.cond
21 ; ARM-NEXT: @ =>This Inner Loop Header: Depth=1
24 ; THUMBV6M-LABEL: fn1:
25 ; THUMBV6M: @ %bb.0: @ %entry
26 ; THUMBV6M-NEXT: rsbs r2, r2, #0
27 ; THUMBV6M-NEXT: sxth r2, r2
28 ; THUMBV6M-NEXT: movs r3, #1
29 ; THUMBV6M-NEXT: adds r0, r1, r0
30 ; THUMBV6M-NEXT: adcs r3, r2
31 ; THUMBV6M-NEXT: lsls r0, r3, #16
32 ; THUMBV6M-NEXT: beq .LBB0_2
33 ; THUMBV6M-NEXT: .LBB0_1: @ %for.cond
34 ; THUMBV6M-NEXT: @ =>This Inner Loop Header: Depth=1
35 ; THUMBV6M-NEXT: b .LBB0_1
36 ; THUMBV6M-NEXT: .LBB0_2: @ %if.end
37 ; THUMBV6M-NEXT: bx lr
39 ; THUMBV8M-BASE-LABEL: fn1:
40 ; THUMBV8M-BASE: @ %bb.0: @ %entry
41 ; THUMBV8M-BASE-NEXT: rsbs r2, r2, #0
42 ; THUMBV8M-BASE-NEXT: sxth r2, r2
43 ; THUMBV8M-BASE-NEXT: movs r3, #1
44 ; THUMBV8M-BASE-NEXT: adds r0, r1, r0
45 ; THUMBV8M-BASE-NEXT: adcs r3, r2
46 ; THUMBV8M-BASE-NEXT: lsls r0, r3, #16
47 ; THUMBV8M-BASE-NEXT: beq .LBB0_2
48 ; THUMBV8M-BASE-NEXT: .LBB0_1: @ %for.cond
49 ; THUMBV8M-BASE-NEXT: @ =>This Inner Loop Header: Depth=1
50 ; THUMBV8M-BASE-NEXT: b .LBB0_1
51 ; THUMBV8M-BASE-NEXT: .LBB0_2: @ %if.end
52 ; THUMBV8M-BASE-NEXT: bx lr
55 ; THUMB: @ %bb.0: @ %entry
56 ; THUMB-NEXT: rsbs r2, r2, #0
57 ; THUMB-NEXT: adds r0, r0, r1
58 ; THUMB-NEXT: sxth r2, r2
59 ; THUMB-NEXT: adc r0, r2, #1
60 ; THUMB-NEXT: lsls r0, r0, #16
63 ; THUMB-NEXT: .LBB0_1: @ %for.cond
64 ; THUMB-NEXT: @ =>This Inner Loop Header: Depth=1
65 ; THUMB-NEXT: b .LBB0_1
68 %cmp = icmp ult i32 %add, %b
69 %conv = zext i1 %cmp to i32
71 %add1 = add i32 %sub, %conv
72 %conv2 = trunc i32 %add1 to i16
73 %tobool = icmp eq i16 %conv2, 0
74 br i1 %tobool, label %if.end, label %for.cond.preheader
76 for.cond.preheader: ; preds = %entry
79 for.cond: ; preds = %for.cond.preheader, %for.cond
82 if.end: ; preds = %entry