1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O2 -mtriple armv7a < %s | FileCheck --check-prefixes=ARM,ARMV7A %s
4 ; RUN: llc -O2 -mtriple thumbv6m < %s | FileCheck --check-prefixes=THUMB1,THUMBV6M %s
5 ; RUN: llc -O2 -mtriple thumbv8m.base < %s | FileCheck --check-prefixes=THUMB1,THUMBV8M-BASE %s
7 ; RUN: llc -O2 -mtriple thumbv7a < %s | FileCheck --check-prefixes=THUMB,THUMBV7A %s
8 ; RUN: llc -O2 -mtriple thumbv8m.main < %s | FileCheck --check-prefixes=THUMB,THUMBV8M-MAIN %s
10 define void @fn1(i32 %a, i32 %b, i32 %c) local_unnamed_addr #0 {
12 ; ARM: @ %bb.0: @ %entry
13 ; ARM-NEXT: adds r0, r1, r0
14 ; ARM-NEXT: mov r3, #0
15 ; ARM-NEXT: adc r0, r3, #0
16 ; ARM-NEXT: movw r1, #65535
17 ; ARM-NEXT: sub r0, r0, r2
18 ; ARM-NEXT: uxth r0, r0
19 ; ARM-NEXT: cmp r0, r1
21 ; ARM-NEXT: .LBB0_1: @ %for.cond
22 ; ARM-NEXT: @ =>This Inner Loop Header: Depth=1
25 ; THUMBV6M-LABEL: fn1:
26 ; THUMBV6M: @ %bb.0: @ %entry
27 ; THUMBV6M-NEXT: movs r3, #0
28 ; THUMBV6M-NEXT: adds r0, r1, r0
29 ; THUMBV6M-NEXT: adcs r3, r3
30 ; THUMBV6M-NEXT: subs r0, r3, r2
31 ; THUMBV6M-NEXT: uxth r0, r0
32 ; THUMBV6M-NEXT: ldr r1, .LCPI0_0
33 ; THUMBV6M-NEXT: cmp r0, r1
34 ; THUMBV6M-NEXT: beq .LBB0_2
35 ; THUMBV6M-NEXT: .LBB0_1: @ %for.cond
36 ; THUMBV6M-NEXT: @ =>This Inner Loop Header: Depth=1
37 ; THUMBV6M-NEXT: b .LBB0_1
38 ; THUMBV6M-NEXT: .LBB0_2: @ %if.end
39 ; THUMBV6M-NEXT: bx lr
40 ; THUMBV6M-NEXT: .p2align 2
41 ; THUMBV6M-NEXT: @ %bb.3:
42 ; THUMBV6M-NEXT: .LCPI0_0:
43 ; THUMBV6M-NEXT: .long 65535 @ 0xffff
45 ; THUMBV8M-BASE-LABEL: fn1:
46 ; THUMBV8M-BASE: @ %bb.0: @ %entry
47 ; THUMBV8M-BASE-NEXT: movs r3, #0
48 ; THUMBV8M-BASE-NEXT: adds r0, r1, r0
49 ; THUMBV8M-BASE-NEXT: adcs r3, r3
50 ; THUMBV8M-BASE-NEXT: subs r0, r3, r2
51 ; THUMBV8M-BASE-NEXT: uxth r0, r0
52 ; THUMBV8M-BASE-NEXT: movw r1, #65535
53 ; THUMBV8M-BASE-NEXT: cmp r0, r1
54 ; THUMBV8M-BASE-NEXT: beq .LBB0_2
55 ; THUMBV8M-BASE-NEXT: .LBB0_1: @ %for.cond
56 ; THUMBV8M-BASE-NEXT: @ =>This Inner Loop Header: Depth=1
57 ; THUMBV8M-BASE-NEXT: b .LBB0_1
58 ; THUMBV8M-BASE-NEXT: .LBB0_2: @ %if.end
59 ; THUMBV8M-BASE-NEXT: bx lr
62 ; THUMB: @ %bb.0: @ %entry
63 ; THUMB-NEXT: adds r0, r0, r1
64 ; THUMB-NEXT: mov.w r3, #0
65 ; THUMB-NEXT: adc r0, r3, #0
66 ; THUMB-NEXT: movw r1, #65535
67 ; THUMB-NEXT: subs r0, r0, r2
68 ; THUMB-NEXT: uxth r0, r0
69 ; THUMB-NEXT: cmp r0, r1
72 ; THUMB-NEXT: .LBB0_1: @ %for.cond
73 ; THUMB-NEXT: @ =>This Inner Loop Header: Depth=1
74 ; THUMB-NEXT: b .LBB0_1
77 %cmp = icmp ult i32 %add, %b
78 %conv = zext i1 %cmp to i32
80 %add1 = add i32 %sub, %conv
81 %conv2 = trunc i32 %add1 to i16
82 %tobool = icmp eq i16 %conv2, 0
83 br i1 %tobool, label %if.end, label %for.cond.preheader
85 for.cond.preheader: ; preds = %entry
88 for.cond: ; preds = %for.cond.preheader, %for.cond
91 if.end: ; preds = %entry