brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 652de9c Raw
27 lines · plain
1; RUN: llc -mtriple=bpfel -mcpu=v1 < %s 2>&1 | FileCheck --check-prefix=CHECK-64 %s2; RUN: llc -mtriple=bpfeb -mcpu=v1 < %s 2>&1 | FileCheck --check-prefix=CHECK-64 %s3; RUN: llc -mtriple=bpfel -mcpu=v1 -mattr=+alu32 < %s 2>&1 | FileCheck --check-prefix=CHECK-32 %s4; RUN: llc -mtriple=bpfeb -mcpu=v1 -mattr=+alu32 < %s 2>&1 | FileCheck --check-prefix=CHECK-32 %s5 6; This file is generated with the source command and source7; $ clang -target bpf -O2 -S -emit-llvm t.c8; $ cat t.c9; int test(int *ptr, unsigned long long a) {10;    __sync_fetch_and_add(ptr, a);11;    return *ptr;12; }13;14; NOTE: passing unsigned long long as the second operand of __sync_fetch_and_add15; could effectively create sub-register reference coming from indexing a full16; register which could then exerceise hasLivingDefs inside BPFMIChecker.cpp.17 18define dso_local i32 @test(ptr nocapture %ptr, i64 %a) {19entry:20  %conv = trunc i64 %a to i3221  %0 = atomicrmw add ptr %ptr, i32 %conv seq_cst22; CHECK-64: lock *(u32 *)(r1 + 0) += r223; CHECK-32: w2 = atomic_fetch_add((u32 *)(r1 + 0), w2)24  %1 = load i32, ptr %ptr, align 425  ret i32 %126}27