1 ; RUN: llc < %s -march=bpf -verify-machineinstrs | FileCheck %s
6 ;load_byte(ptr skb, unsigned long long off) asm("llvm.bpf.load.byte");
8 ;load_half(ptr skb, unsigned long long off) asm("llvm.bpf.load.half");
9 ;typedef unsigned char uint8_t;
10 ;typedef unsigned short uint16_t;
12 ;int func_b(struct __sk_buff *skb)
14 ; uint8_t t = load_byte(skb, 0);
18 ;int func_h(struct __sk_buff *skb)
20 ; uint16_t t = load_half(skb, 0);
24 ;int func_w(struct __sk_buff *skb)
26 ; uint32_t t = load_word(skb, 0);
30 %struct.__sk_buff = type opaque
32 ; Function Attrs: nounwind readonly
33 define i32 @func_b(ptr %skb) local_unnamed_addr #0 {
35 %call = tail call i64 @llvm.bpf.load.byte(ptr %skb, i64 0)
36 %conv = trunc i64 %call to i32
37 %conv1 = and i32 %conv, 255
38 ; CHECK-NOT: r0 &= 255
42 ; Function Attrs: nounwind readonly
43 declare i64 @llvm.bpf.load.byte(ptr, i64) #1
45 ; Function Attrs: nounwind readonly
46 define i32 @func_h(ptr %skb) local_unnamed_addr #0 {
48 %call = tail call i64 @llvm.bpf.load.half(ptr %skb, i64 0)
49 %conv = trunc i64 %call to i32
50 %conv1 = and i32 %conv, 65535
51 ; CHECK-NOT: r0 &= 65535
55 ; Function Attrs: nounwind readonly
56 declare i64 @llvm.bpf.load.half(ptr, i64) #1