1 ; RUN: llc -march=bpfel < %s 2>&1 | FileCheck --check-prefix=CHECK-64 %s
2 ; RUN: llc -march=bpfeb < %s 2>&1 | FileCheck --check-prefix=CHECK-64 %s
3 ; RUN: llc -march=bpfel -mattr=+alu32 < %s 2>&1 | FileCheck --check-prefix=CHECK-32 %s
4 ; RUN: llc -march=bpfeb -mattr=+alu32 < %s 2>&1 | FileCheck --check-prefix=CHECK-32 %s
6 ; This file is generated with the source command and source
7 ; $ clang -target bpf -O2 -S -emit-llvm t.c
9 ; int test(int *ptr, unsigned long long a) {
10 ; __sync_fetch_and_add(ptr, a);
14 ; NOTE: passing unsigned long long as the second operand of __sync_fetch_and_add
15 ; could effectively create sub-register reference coming from indexing a full
16 ; register which could then exerceise hasLivingDefs inside BPFMIChecker.cpp.
18 define dso_local i32 @test(ptr nocapture %ptr, i64 %a) {
20 %conv = trunc i64 %a to i32
21 %0 = atomicrmw add ptr %ptr, i32 %conv seq_cst
22 ; CHECK-64: lock *(u32 *)(r1 + 0) += r2
23 ; CHECK-32: lock *(u32 *)(r1 + 0) += w2
24 %1 = load i32, ptr %ptr, align 4