1; RUN: llc -march=bpfel -o - %s | FileCheck %s
2; RUN: llc -march=bpfeb -o - %s | FileCheck %s
3; Source code:
4;   struct ipv6_key_t {
5;     unsigned pid;
6;     unsigned __int128 saddr;
7;     unsigned short lport;
8;   };
9;
10;   extern void test1(void *);
11;   int test(int pid) {
12;     struct ipv6_key_t ipv6_key = {.pid = pid};
13;     test1(&ipv6_key);
14;     return 0;
15;   }
16; Compilation flag:
17;   clang -target bpf -O2 -S -emit-llvm t.c
18
19%struct.ipv6_key_t = type { i32, i128, i16 }
20
21; Function Attrs: nounwind
22define dso_local i32 @test(i32 %pid) local_unnamed_addr #0 {
23entry:
24  %ipv6_key = alloca %struct.ipv6_key_t, align 16
25  %0 = bitcast %struct.ipv6_key_t* %ipv6_key to i8*
26  call void @llvm.lifetime.start.p0i8(i64 48, i8* nonnull %0) #4
27  call void @llvm.memset.p0i8.i64(i8* nonnull align 16 dereferenceable(48) %0, i8 0, i64 48, i1 false)
28  %pid1 = getelementptr inbounds %struct.ipv6_key_t, %struct.ipv6_key_t* %ipv6_key, i64 0, i32 0
29  store i32 %pid, i32* %pid1, align 16, !tbaa !2
30  call void @test1(i8* nonnull %0) #4
31  call void @llvm.lifetime.end.p0i8(i64 48, i8* nonnull %0) #4
32  ret i32 0
33}
34
35; CHECK-LABEL: test
36; CHECK:       *(u64 *)(r10 - 48) = r{{[0-9]+}}
37; CHECK:       *(u32 *)(r10 - 48) = r{{[0-9]+}}
38
39; Function Attrs: argmemonly nounwind willreturn
40declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
41
42; Function Attrs: argmemonly nounwind willreturn writeonly
43declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #2
44
45declare dso_local void @test1(i8*) local_unnamed_addr #3
46
47; Function Attrs: argmemonly nounwind willreturn
48declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
49
50attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
51attributes #1 = { argmemonly nounwind willreturn }
52attributes #2 = { argmemonly nounwind willreturn writeonly }
53attributes #3 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
54attributes #4 = { nounwind }
55
56!llvm.module.flags = !{!0}
57!llvm.ident = !{!1}
58
59!0 = !{i32 1, !"wchar_size", i32 4}
60!1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 55fc7a47f8f18f84b44ff16f4e7a420c0a42ddf1)"}
61!2 = !{!3, !4, i64 0}
62!3 = !{!"ipv6_key_t", !4, i64 0, !7, i64 16, !8, i64 32}
63!4 = !{!"int", !5, i64 0}
64!5 = !{!"omnipotent char", !6, i64 0}
65!6 = !{!"Simple C/C++ TBAA"}
66!7 = !{!"__int128", !5, i64 0}
67!8 = !{!"short", !5, i64 0}
68