47 lines · plain
1; RUN: llc -O2 --mtriple=bpfel %s -o - | FileCheck %s2 3; Generated from the following C code:4;5; #define __bpf_fastcall __attribute__((bpf_fastcall))6;7; void bar(void) __bpf_fastcall;8; void buz(long i, long j, long k);9;10; void foo(long i, long j, long k) {11; bar();12; buz(i, j, k);13; }14;15; Using the following command:16;17; clang --target=bpf -emit-llvm -O2 -S -o - t.c18;19; (unnecessary attrs removed maually)20 21; Check that function marked with bpf_fastcall does not clobber R1-R5.22 23define dso_local void @foo(i64 noundef %i, i64 noundef %j, i64 noundef %k) {24entry:25 tail call void @bar() #126 tail call void @buz(i64 noundef %i, i64 noundef %j, i64 noundef %k)27 ret void28}29 30; CHECK: foo:31; CHECK: # %bb.0:32; CHECK-NEXT: *(u64 *)(r10 - 8) = r133; CHECK-NEXT: *(u64 *)(r10 - 16) = r234; CHECK-NEXT: *(u64 *)(r10 - 24) = r335; CHECK-NEXT: call bar36; CHECK-NEXT: r3 = *(u64 *)(r10 - 24)37; CHECK-NEXT: r2 = *(u64 *)(r10 - 16)38; CHECK-NEXT: r1 = *(u64 *)(r10 - 8)39; CHECK-NEXT: call buz40; CHECK-NEXT: exit41 42declare dso_local void @bar() #043declare dso_local void @buz(i64 noundef, i64 noundef, i64 noundef)44 45attributes #0 = { "bpf_fastcall" }46attributes #1 = { nounwind "bpf_fastcall" }47