1 ; RUN: llc -mtriple=bpfel -mcpu=v1 -filetype=obj -o %t.el < %s
2 ; RUN: llvm-objdump -r %t.el | FileCheck --check-prefix=RELOC %s
3 ; RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.el | FileCheck --check-prefix=DUMP %s
4 ; RUN: llc -mtriple=bpfeb -mcpu=v1 -filetype=obj -o %t.eb < %s
5 ; RUN: llvm-objdump -r %t.eb | FileCheck --check-prefix=RELOC %s
6 ; RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.eb | FileCheck --check-prefix=DUMP %s
9 ; static __attribute__((noinline)) __attribute__((section("sec1")))
10 ; int add(int a, int b) {
13 ; static __attribute__((noinline))
14 ; int sub(int a, int b) {
17 ; int test(int a, int b) {
18 ; return add(a, b) + sub(a, b);
21 ; clang -target bpf -O2 -emit-llvm -S test.c
23 define dso_local i32 @test(i32 %a, i32 %b) local_unnamed_addr #0 {
25 %call = tail call fastcc i32 @add(i32 %a, i32 %b)
26 %call1 = tail call fastcc i32 @sub(i32 %a, i32 %b)
27 %add = add nsw i32 %call1, %call
31 define internal fastcc i32 @add(i32 %a, i32 %b) unnamed_addr #1 section "sec1" {
33 %add = add nsw i32 %b, %a
37 ; Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn mustprogress
38 define internal fastcc i32 @sub(i32 %a, i32 %b) unnamed_addr #1 {
40 %sub = sub nsw i32 %a, %b
47 ; DUMP-NEXT: r[[#]] = r[[#]]
48 ; DUMP-NEXT: r[[#]] = r[[#]]
55 ; RELOC: RELOCATION RECORDS FOR [.text]:
56 ; RELOC: R_BPF_64_32 sec1
57 ; RELOC-NOT: R_BPF_64_32
59 attributes #0 = { nofree norecurse nosync nounwind readnone willreturn mustprogress "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
60 attributes #1 = { nofree noinline norecurse nosync nounwind readnone willreturn mustprogress "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }