Alexei Starovoitov | 8cf9a4c | 2015-06-05 16:11:14 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=bpfel | FileCheck %s |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 2 | |
| 3 | %struct.bpf_context = type { i64, i64, i64, i64, i64, i64, i64 } |
| 4 | %struct.sk_buff = type { i64, i64, i64, i64, i64, i64, i64 } |
| 5 | %struct.net_device = type { i64, i64, i64, i64, i64, i64, i64 } |
| 6 | |
| 7 | @bpf_prog1.devname = private unnamed_addr constant [3 x i8] c"lo\00", align 1 |
| 8 | @bpf_prog1.fmt = private unnamed_addr constant [15 x i8] c"skb %x dev %x\0A\00", align 1 |
| 9 | |
| 10 | ; Function Attrs: nounwind uwtable |
| 11 | define i32 @bpf_prog1(%struct.bpf_context* nocapture %ctx) #0 section "events/net/netif_receive_skb" { |
| 12 | %devname = alloca [3 x i8], align 1 |
| 13 | %fmt = alloca [15 x i8], align 1 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 14 | %1 = getelementptr inbounds [3 x i8], [3 x i8]* %devname, i64 0, i64 0 |
Daniel Neilson | 1e68724 | 2018-01-19 17:13:12 +0000 | [diff] [blame] | 15 | call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @bpf_prog1.devname, i64 0, i64 0), i64 3, i1 false) |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 16 | %2 = getelementptr inbounds %struct.bpf_context, %struct.bpf_context* %ctx, i64 0, i32 0 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 17 | %3 = load i64, i64* %2, align 8 |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 18 | %4 = inttoptr i64 %3 to %struct.sk_buff* |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 19 | %5 = getelementptr inbounds %struct.sk_buff, %struct.sk_buff* %4, i64 0, i32 2 |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 20 | %6 = bitcast i64* %5 to i8* |
| 21 | %7 = call i8* inttoptr (i64 4 to i8* (i8*)*)(i8* %6) #1 |
| 22 | %8 = call i32 inttoptr (i64 9 to i32 (i8*, i8*, i32)*)(i8* %7, i8* %1, i32 2) #1 |
| 23 | %9 = icmp eq i32 %8, 0 |
| 24 | br i1 %9, label %10, label %13 |
| 25 | |
| 26 | ; <label>:10 ; preds = %0 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 27 | %11 = getelementptr inbounds [15 x i8], [15 x i8]* %fmt, i64 0, i64 0 |
Daniel Neilson | 1e68724 | 2018-01-19 17:13:12 +0000 | [diff] [blame] | 28 | call void @llvm.memcpy.p0i8.p0i8.i64(i8* %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @bpf_prog1.fmt, i64 0, i64 0), i64 15, i1 false) |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 29 | %12 = call i32 (i8*, i32, ...) inttoptr (i64 11 to i32 (i8*, i32, ...)*)(i8* %11, i32 15, %struct.sk_buff* %4, i8* %7) #1 |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 30 | ; CHECK-LABEL: bpf_prog1: |
| 31 | ; CHECK: call 4 |
| 32 | ; CHECK: call 9 |
Alexei Starovoitov | 8f9f821 | 2016-11-18 02:32:35 +0000 | [diff] [blame] | 33 | ; CHECK: if r0 != 0 |
| 34 | ; CHECK: r1 = 622884453 |
Yonghong Song | be9c003 | 2017-09-11 23:43:35 +0000 | [diff] [blame] | 35 | ; CHECK: r1 = 7214898703899978611 ll |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 36 | ; CHECK: call 11 |
Alexei Starovoitov | 8f9f821 | 2016-11-18 02:32:35 +0000 | [diff] [blame] | 37 | ; CHECK: r0 = 0 |
| 38 | ; CHECK: exit |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 39 | br label %13 |
| 40 | |
| 41 | ; <label>:13 ; preds = %10, %0 |
| 42 | ret i32 0 |
| 43 | } |
| 44 | |
| 45 | ; Function Attrs: nounwind |
Daniel Neilson | 1e68724 | 2018-01-19 17:13:12 +0000 | [diff] [blame] | 46 | declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) #1 |