1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=bpfel-- | FileCheck %s
4 @foo_printf.fmt = private unnamed_addr constant [9 x i8] c"hello \0A\00", align 1
6 ; Function Attrs: nounwind readnone uwtable
7 define i32 @foo_int(i32 %a, i32 %b) #0 {
8 ; CHECK-LABEL: foo_int:
11 ; CHECK-NEXT: r0 += r1
13 %1 = add nsw i32 %b, %a
17 ; Function Attrs: nounwind readnone uwtable
18 define signext i8 @foo_char(i8 signext %a, i8 signext %b) #0 {
19 ; CHECK-LABEL: foo_char:
22 ; CHECK-NEXT: r0 += r1
23 ; CHECK-NEXT: r0 <<= 56
24 ; CHECK-NEXT: r0 s>>= 56
30 ; Function Attrs: nounwind readnone uwtable
31 define i64 @foo_ll(i64 %a, i64 %b, i64 %c) #0 {
32 ; CHECK-LABEL: foo_ll:
35 ; CHECK-NEXT: r0 += r1
36 ; CHECK-NEXT: r0 -= r3
38 %1 = add nsw i64 %b, %a
43 ; Function Attrs: nounwind uwtable
44 define void @foo_call2(i32 %a, i32 %b) #1 {
45 ; CHECK-LABEL: foo_call2:
48 ; CHECK-NEXT: r2 <<= 56
49 ; CHECK-NEXT: r2 s>>= 56
52 ; CHECK-NEXT: call foo_2arg
54 %1 = trunc i32 %b to i8
55 tail call void @foo_2arg(i8 signext %1, i32 %a) #3
59 declare void @foo_2arg(i8 signext, i32) #2
61 ; Function Attrs: nounwind uwtable
62 define i32 @foo_call5(i8 signext %a, i16 signext %b, i32 %c, i64 %d) #1 {
63 ; CHECK-LABEL: foo_call5:
65 ; CHECK-NEXT: call bar
68 %1 = tail call i32 @bar(i8 signext %a, i16 signext %b, i32 %c, i64 %d) #3
72 declare i32 @bar(i8 signext, i16 signext, i32, i64) #2
74 ; Function Attrs: nounwind readnone uwtable
75 define signext i8 @foo_cmp(i8 signext %a, i8 signext %b) #0 {
76 ; CHECK-LABEL: foo_cmp:
79 ; CHECK-NEXT: if r2 s> r0 goto LBB5_2
80 ; CHECK-NEXT: # %bb.1:
84 %1 = icmp slt i8 %a, %b
85 %a.b = select i1 %1, i8 %a, i8 %b
89 ; Function Attrs: nounwind readnone uwtable
90 define i32 @foo_muldiv(i8 signext %a, i16 signext %b, i32 %c, i64 %d) #0 {
91 ; CHECK-LABEL: foo_muldiv:
94 ; CHECK-NEXT: if r1 == 0 goto LBB6_2
95 ; CHECK-NEXT: # %bb.1:
96 ; CHECK-NEXT: r0 *= r3
97 ; CHECK-NEXT: goto LBB6_3
99 ; CHECK-NEXT: r3 <<= 32
100 ; CHECK-NEXT: r3 >>= 32
101 ; CHECK-NEXT: r4 <<= 32
102 ; CHECK-NEXT: r4 >>= 32
103 ; CHECK-NEXT: r4 /= r3
104 ; CHECK-NEXT: r0 = r4
105 ; CHECK-NEXT: LBB6_3:
107 %1 = icmp eq i8 %a, 0
108 br i1 %1, label %5, label %2
110 ; <label>:2 ; preds = %0
111 %3 = sext i16 %b to i32
112 %4 = mul nsw i32 %3, %c
115 ; <label>:5 ; preds = %0
116 %6 = trunc i64 %d to i32
120 ; <label>:8 ; preds = %5, %2
121 %.0 = phi i32 [ %4, %2 ], [ %7, %5 ]
125 ; Function Attrs: nounwind uwtable
126 define i32 @foo_optimized() #1 {
127 ; CHECK-LABEL: foo_optimized:
134 ; CHECK-NEXT: call manyarg
136 %1 = tail call i32 @manyarg(i32 1, i32 2, i32 3, i32 4, i32 5) #3
140 declare i32 @manyarg(i32, i32, i32, i32, i32) #2
142 ; Function Attrs: nounwind uwtable
143 define void @foo_printf() #1 {
144 ; CHECK-LABEL: foo_printf:
147 ; CHECK-NEXT: *(u8 *)(r10 - 8) = r1
148 ; CHECK-NEXT: r1 = 729618802566522216 ll
149 ; CHECK-NEXT: *(u64 *)(r10 - 16) = r1
150 ; CHECK-NEXT: r1 = r10
151 ; CHECK-NEXT: r1 += -16
152 ; CHECK-NEXT: call printf
154 %fmt = alloca [9 x i8], align 1
155 call void @llvm.memcpy.p0.p0.i64(ptr %fmt, ptr @foo_printf.fmt, i64 9, i1 false)
156 %1 = call i32 (ptr, ...) @printf(ptr %fmt) #3
160 ; Function Attrs: nounwind
161 declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) #3
163 ; Function Attrs: nounwind
164 declare i32 @printf(ptr nocapture, ...) #4