brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 6340be3 Raw
63 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 quux(void *);8; void bar(long) __bpf_fastcall;9; void buz(long i, long j);10;11; void foo(long i, long j) {12;   long k;13;   bar(i);14;   bar(i);15;   buz(i, j);16;   quux(&k);17; }18;19; Using the following command:20;21;   clang --target=bpf -emit-llvm -O2 -S -o - t.c22;23; (unnecessary attrs removed maually)24 25; Check that function marked with bpf_fastcall does not clobber R1-R5.26; Check that spills/fills wrapping the call use and reuse lowest stack offsets.27 28define dso_local void @foo(i64 noundef %i, i64 noundef %j) {29entry:30  %k = alloca i64, align 831  tail call void @bar(i64 noundef %i) #032  tail call void @bar(i64 noundef %i) #033  tail call void @buz(i64 noundef %i, i64 noundef %j)34  call void @quux(ptr noundef nonnull %k)35  ret void36}37 38; CHECK:      # %bb.0:39; CHECK-NEXT:   r3 = r140; CHECK-NEXT:   *(u64 *)(r10 - 16) = r241; CHECK-NEXT:   *(u64 *)(r10 - 24) = r342; CHECK-NEXT:   call bar43; CHECK-NEXT:   r3 = *(u64 *)(r10 - 24)44; CHECK-NEXT:   r2 = *(u64 *)(r10 - 16)45; CHECK-NEXT:   r1 = r346; CHECK-NEXT:   *(u64 *)(r10 - 16) = r247; CHECK-NEXT:   *(u64 *)(r10 - 24) = r348; CHECK-NEXT:   call bar49; CHECK-NEXT:   r3 = *(u64 *)(r10 - 24)50; CHECK-NEXT:   r2 = *(u64 *)(r10 - 16)51; CHECK-NEXT:   r1 = r352; CHECK-NEXT:   call buz53; CHECK-NEXT:   r1 = r1054; CHECK-NEXT:   r1 += -855; CHECK-NEXT:   call quux56; CHECK-NEXT:   exit57 58declare dso_local void @bar(i64 noundef) #059declare dso_local void @buz(i64 noundef, i64 noundef)60declare dso_local void @quux(ptr noundef)61 62attributes #0 = { "bpf_fastcall" }63