[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / CodeGen / BPF / BTF / extern-builtin.ll
bloba8550167de1823c52f55206661c82f9fed9f493e
1 ; RUN: llc -mtriple=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
2 ; RUN: llc -mtriple=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
3 ; Source code:
4 ;   unsigned long long load_byte(ptr skb,
5 ;       unsigned long long off) asm("llvm.bpf.load.byte");
6 ;   unsigned long long test(ptr skb) {
7 ;     return load_byte(skb, 10);
8 ;   }
9 ; Compilation flag:
10 ;   clang -target bpf -O2 -g -S -emit-llvm test.c
12 ; Function Attrs: nounwind readonly
13 define dso_local i64 @test(ptr readonly %skb) local_unnamed_addr #0 !dbg !13 {
14 entry:
15   call void @llvm.dbg.value(metadata ptr %skb, metadata !17, metadata !DIExpression()), !dbg !18
16   %call = tail call i64 @llvm.bpf.load.byte(ptr %skb, i64 10), !dbg !19
17   ret i64 %call, !dbg !20
20 ; CHECK:             .section        .BTF,"",@progbits
21 ; CHECK-NEXT:        .short  60319                   # 0xeb9f
22 ; CHECK-NEXT:        .byte   1
23 ; CHECK-NEXT:        .byte   0
24 ; CHECK-NEXT:        .long   24
25 ; CHECK-NEXT:        .long   0
26 ; CHECK-NEXT:        .long   60
27 ; CHECK-NEXT:        .long   60
28 ; CHECK-NEXT:        .long   78
29 ; CHECK-NEXT:        .long   0                       # BTF_KIND_PTR(id = 1)
30 ; CHECK-NEXT:        .long   33554432                # 0x2000000
31 ; CHECK-NEXT:        .long   0
32 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 2)
33 ; CHECK-NEXT:        .long   218103809               # 0xd000001
34 ; CHECK-NEXT:        .long   3
35 ; CHECK-NEXT:        .long   1
36 ; CHECK-NEXT:        .long   1
37 ; CHECK-NEXT:        .long   5                       # BTF_KIND_INT(id = 3)
38 ; CHECK-NEXT:        .long   16777216                # 0x1000000
39 ; CHECK-NEXT:        .long   8
40 ; CHECK-NEXT:        .long   64                      # 0x40
41 ; CHECK-NEXT:        .long   28                      # BTF_KIND_FUNC(id = 4)
42 ; CHECK-NEXT:        .long   201326593               # 0xc000001
43 ; CHECK-NEXT:        .long   2
44 ; CHECK-NEXT:        .byte   0                       # string offset=0
45 ; CHECK-NEXT:        .ascii  "skb"                   # string offset=1
46 ; CHECK-NEXT:        .byte   0
47 ; CHECK-NEXT:        .ascii  "long long unsigned int" # string offset=5
48 ; CHECK-NEXT:        .byte   0
49 ; CHECK-NEXT:        .ascii  "test"                  # string offset=28
50 ; CHECK-NEXT:        .byte   0
51 ; CHECK-NEXT:        .ascii  ".text"                 # string offset=33
52 ; CHECK-NEXT:        .byte   0
53 ; CHECK-NEXT:        .ascii  "/tmp/home/yhs/work/tests/extern/test.c" # string offset=39
54 ; CHECK-NEXT:        .byte   0
56 ; Function Attrs: nounwind readonly
57 declare !dbg !4 i64 @llvm.bpf.load.byte(ptr, i64) #1
58 ; Function Attrs: nounwind readnone speculatable willreturn
59 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
61 attributes #0 = { nounwind readonly "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" }
62 attributes #1 = { nounwind readonly }
63 attributes #2 = { nounwind readnone speculatable willreturn }
65 !llvm.dbg.cu = !{!0}
66 !llvm.module.flags = !{!9, !10, !11}
67 !llvm.ident = !{!12}
69 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 907019d835895443b198afcd992c42c9d3478fdf)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
70 !1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/extern")
71 !2 = !{}
72 !3 = !{!4}
73 !4 = !DISubprogram(name: "load_byte", linkageName: "llvm.bpf.load.byte", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
74 !5 = !DISubroutineType(types: !6)
75 !6 = !{!7, !8, !7}
76 !7 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)
77 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
78 !9 = !{i32 7, !"Dwarf Version", i32 4}
79 !10 = !{i32 2, !"Debug Info Version", i32 3}
80 !11 = !{i32 1, !"wchar_size", i32 4}
81 !12 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 907019d835895443b198afcd992c42c9d3478fdf)"}
82 !13 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 3, type: !14, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !16)
83 !14 = !DISubroutineType(types: !15)
84 !15 = !{!7, !8}
85 !16 = !{!17}
86 !17 = !DILocalVariable(name: "skb", arg: 1, scope: !13, file: !1, line: 3, type: !8)
87 !18 = !DILocation(line: 0, scope: !13)
88 !19 = !DILocation(line: 4, column: 10, scope: !13)
89 !20 = !DILocation(line: 4, column: 3, scope: !13)