1; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
2; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s
3
4; Source code:
5;   extern char a;
6;   int foo() { return a; }
7; Compilation flag:
8;   clang -target bpf -O2 -g -S -emit-llvm test.c
9
10@a = external dso_local local_unnamed_addr global i8, align 1
11
12; Function Attrs: norecurse nounwind readonly
13define dso_local i32 @foo() local_unnamed_addr #0 !dbg !7 {
14  %1 = load i8, i8* @a, align 1, !dbg !11, !tbaa !12
15  %2 = sext i8 %1 to i32, !dbg !11
16  ret i32 %2, !dbg !15
17}
18
19; CHECK:             .section        .BTF,"",@progbits
20; CHECK-NEXT:        .short  60319                   # 0xeb9f
21; CHECK-NEXT:        .byte   1
22; CHECK-NEXT:        .byte   0
23; CHECK-NEXT:        .long   24
24; CHECK-NEXT:        .long   0
25; CHECK-NEXT:        .long   40
26; CHECK-NEXT:        .long   40
27; CHECK-NEXT:        .long   52
28; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 1)
29; CHECK-NEXT:        .long   218103808               # 0xd000000
30; CHECK-NEXT:        .long   2
31; CHECK-NEXT:        .long   1                       # BTF_KIND_INT(id = 2)
32; CHECK-NEXT:        .long   16777216                # 0x1000000
33; CHECK-NEXT:        .long   4
34; CHECK-NEXT:        .long   16777248                # 0x1000020
35; CHECK-NEXT:        .long   5                       # BTF_KIND_FUNC(id = 3)
36; CHECK-NEXT:        .long   201326593               # 0xc000001
37; CHECK-NEXT:        .long   1
38; CHECK-NEXT:        .byte   0                       # string offset=0
39; CHECK-NEXT:        .ascii  "int"                   # string offset=1
40; CHECK-NEXT:        .byte   0
41; CHECK-NEXT:        .ascii  "foo"                   # string offset=5
42; CHECK-NEXT:        .byte   0
43; CHECK-NEXT:        .ascii  ".text"                 # string offset=9
44; CHECK-NEXT:        .byte   0
45; CHECK-NEXT:        .ascii  "/home/yhs/work/tests/llvm/bug/test.c" # string offset=15
46; CHECK-NEXT:        .byte   0
47
48attributes #0 = { norecurse nounwind readonly "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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" }
49
50!llvm.dbg.cu = !{!0}
51!llvm.module.flags = !{!3, !4, !5}
52!llvm.ident = !{!6}
53
54!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.20181009 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
55!1 = !DIFile(filename: "test.c", directory: "/home/yhs/work/tests/llvm/bug")
56!2 = !{}
57!3 = !{i32 2, !"Dwarf Version", i32 4}
58!4 = !{i32 2, !"Debug Info Version", i32 3}
59!5 = !{i32 1, !"wchar_size", i32 4}
60!6 = !{!"clang version 8.0.20181009 "}
61!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: true, unit: !0, retainedNodes: !2)
62!8 = !DISubroutineType(types: !9)
63!9 = !{!10}
64!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
65!11 = !DILocation(line: 2, column: 20, scope: !7)
66!12 = !{!13, !13, i64 0}
67!13 = !{!"omnipotent char", !14, i64 0}
68!14 = !{!"Simple C/C++ TBAA"}
69!15 = !DILocation(line: 2, column: 13, scope: !7)
70