1 ; RUN: llc < %s -march=bpfel | FileCheck -check-prefixes=CHECK,EL %s
2 ; RUN: llc < %s -march=bpfeb | FileCheck -check-prefixes=CHECK,EB %s
4 %struct.bpf_map_def = type { i32, i32, i32, i32 }
5 %struct.__sk_buff = type opaque
6 %struct.routing_key_2 = type { [6 x i8] }
8 @routing = global %struct.bpf_map_def { i32 1, i32 6, i32 12, i32 1024 }, section "maps", align 4
9 @routing_miss_0 = global %struct.bpf_map_def { i32 1, i32 1, i32 12, i32 1 }, section "maps", align 4
10 @test1 = global %struct.bpf_map_def { i32 2, i32 4, i32 8, i32 1024 }, section "maps", align 4
11 @test1_miss_4 = global %struct.bpf_map_def { i32 2, i32 1, i32 8, i32 1 }, section "maps", align 4
12 @_license = global [4 x i8] c"GPL\00", section "license", align 1
13 @llvm.used = appending global [6 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @_license, i32 0, i32 0), i8* bitcast (i32 (%struct.__sk_buff*)* @ebpf_filter to i8*), i8* bitcast (%struct.bpf_map_def* @routing to i8*), i8* bitcast (%struct.bpf_map_def* @routing_miss_0 to i8*), i8* bitcast (%struct.bpf_map_def* @test1 to i8*), i8* bitcast (%struct.bpf_map_def* @test1_miss_4 to i8*)], section "llvm.metadata"
15 ; Function Attrs: nounwind uwtable
16 define i32 @ebpf_filter(%struct.__sk_buff* nocapture readnone %ebpf_packet) #0 section "socket1" {
18 ; EL: r1 = 11033905661445 ll
19 ; EB: r1 = 361984551142686720 ll
20 ; CHECK: *(u64 *)(r10 - 8) = r1
23 ; CHECK-DAG: *(u16 *)(r10 + 24) = r1
24 ; CHECK-DAG: *(u16 *)(r10 + 22) = r1
25 ; CHECK-DAG: *(u16 *)(r10 + 20) = r1
26 ; CHECK-DAG: *(u16 *)(r10 + 18) = r1
27 ; CHECK-DAG: *(u16 *)(r10 + 16) = r1
28 ; CHECK-DAG: *(u16 *)(r10 + 14) = r1
29 ; CHECK-DAG: *(u16 *)(r10 + 12) = r1
30 ; CHECK-DAG: *(u16 *)(r10 + 10) = r1
31 ; CHECK-DAG: *(u16 *)(r10 + 8) = r1
32 ; CHECK-DAG: *(u16 *)(r10 + 6) = r1
33 ; CHECK-DAG: *(u16 *)(r10 + 4) = r1
34 ; CHECK-DAG: *(u16 *)(r10 + 2) = r1
35 ; CHECK-DAG: *(u16 *)(r10 + 0) = r1
36 ; CHECK-DAG: *(u16 *)(r10 + 26) = r1
41 ; CHECK: call bpf_map_lookup_elem
43 %key = alloca %struct.routing_key_2, align 1
44 %1 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 0
45 store i8 5, i8* %1, align 1
46 %2 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 1
47 store i8 6, i8* %2, align 1
48 %3 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 2
49 store i8 7, i8* %3, align 1
50 %4 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 3
51 store i8 8, i8* %4, align 1
52 %5 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 4
53 store i8 9, i8* %5, align 1
54 %6 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 0, i32 0, i64 5
55 store i8 10, i8* %6, align 1
56 %7 = getelementptr inbounds %struct.routing_key_2, %struct.routing_key_2* %key, i64 1, i32 0, i64 0
57 call void @llvm.memset.p0i8.i64(i8* %7, i8 0, i64 30, i1 false)
58 %8 = call i32 (%struct.bpf_map_def*, %struct.routing_key_2*, ...) bitcast (i32 (...)* @bpf_map_lookup_elem to i32 (%struct.bpf_map_def*, %struct.routing_key_2*, ...)*)(%struct.bpf_map_def* nonnull @routing, %struct.routing_key_2* nonnull %key) #3
62 ; Function Attrs: nounwind argmemonly
63 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) #1
65 declare i32 @bpf_map_lookup_elem(...) #2