xref: /llvm-project/llvm/test/CodeGen/BPF/struct-arg.ll (revision c5037db4acd95790a0ca5061c8fa79c5c291607e)
1*c5037db4SFangrui Song; RUN: llc < %s -mtriple=bpfel | FileCheck %s
2481d67d3SYonghong Song; Source:
3481d67d3SYonghong Song;   struct t1 {
4481d67d3SYonghong Song;     long a;
5481d67d3SYonghong Song;   };
6481d67d3SYonghong Song;   struct t2 {
7481d67d3SYonghong Song;     long a;
8481d67d3SYonghong Song;     long b;
9481d67d3SYonghong Song;   };
10481d67d3SYonghong Song;   long foo2(struct t1 a1, struct t1 a2, struct t1 a3, struct t1 a4, struct t1 a5) {
11481d67d3SYonghong Song;     return a1.a + a2.a + a3.a + a4.a + a5.a;
12481d67d3SYonghong Song;   }
13481d67d3SYonghong Song;   long foo3(struct t2 a1, struct t2 a2, struct t1 a3) {
14481d67d3SYonghong Song;     return a1.a + a2.a + a3.a;
15481d67d3SYonghong Song;   }
16481d67d3SYonghong Song; Compilation flags:
17481d67d3SYonghong Song;   clang -target bpf -S -emit-llvm -O2 t.c
18481d67d3SYonghong Song
19481d67d3SYonghong Song; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
20481d67d3SYonghong Songdefine dso_local i64 @foo2(i64 %a1.coerce, i64 %a2.coerce, i64 %a3.coerce, i64 %a4.coerce, i64 %a5.coerce) local_unnamed_addr #0 {
21481d67d3SYonghong Songentry:
22481d67d3SYonghong Song  %add = add nsw i64 %a2.coerce, %a1.coerce
23481d67d3SYonghong Song  %add8 = add nsw i64 %add, %a3.coerce
24481d67d3SYonghong Song  %add10 = add nsw i64 %add8, %a4.coerce
25481d67d3SYonghong Song  %add12 = add nsw i64 %add10, %a5.coerce
26481d67d3SYonghong Song  ret i64 %add12
27481d67d3SYonghong Song; CHECK:        r0 = r2
28481d67d3SYonghong Song; CHECK:        r0 += r1
29481d67d3SYonghong Song; CHECK:        r0 += r3
30481d67d3SYonghong Song; CHECK:        r0 += r4
31481d67d3SYonghong Song; CHECK:        r0 += r5
32481d67d3SYonghong Song; CHECK-NEXT:   exit
33481d67d3SYonghong Song}
34481d67d3SYonghong Song
35481d67d3SYonghong Song; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn
36481d67d3SYonghong Songdefine dso_local i64 @foo3([2 x i64] %a1.coerce, [2 x i64] %a2.coerce, i64 %a3.coerce) local_unnamed_addr #0 {
37481d67d3SYonghong Songentry:
38481d67d3SYonghong Song  %a1.coerce.fca.0.extract = extractvalue [2 x i64] %a1.coerce, 0
39481d67d3SYonghong Song  %a2.coerce.fca.0.extract = extractvalue [2 x i64] %a2.coerce, 0
40481d67d3SYonghong Song  %add = add nsw i64 %a2.coerce.fca.0.extract, %a1.coerce.fca.0.extract
41481d67d3SYonghong Song  %add6 = add nsw i64 %add, %a3.coerce
42481d67d3SYonghong Song  ret i64 %add6
43481d67d3SYonghong Song; CHECK:        r0 = r3
44481d67d3SYonghong Song; CHECK-NEXT:   r0 += r1
45481d67d3SYonghong Song; CHECK-NEXT:   r0 += r5
46481d67d3SYonghong Song; CHECK-NEXT:   exit
47481d67d3SYonghong Song}
48481d67d3SYonghong Song
49481d67d3SYonghong Songattributes #0 = { mustprogress nofree norecurse nosync nounwind readnone willreturn "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
50481d67d3SYonghong Song
51481d67d3SYonghong Song!llvm.module.flags = !{!0, !1}
52481d67d3SYonghong Song!llvm.ident = !{!2}
53481d67d3SYonghong Song
54481d67d3SYonghong Song!0 = !{i32 1, !"wchar_size", i32 4}
55481d67d3SYonghong Song!1 = !{i32 7, !"frame-pointer", i32 2}
56481d67d3SYonghong Song!2 = !{!"clang version 16.0.0 (https://github.com/llvm/llvm-project.git 9385660f4ca87d074410a84df89faca313afcb5a)"}
57