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 5 6; This file is generated with the source command and source 7; $ clang -target bpf -O2 -S -emit-llvm t.c 8; $ cat t.c 9; 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_add 15; could effectively create sub-register reference coming from indexing a full 16; register which could then exerceise hasLivingDefs inside BPFMIChecker.cpp. 17 18define dso_local i32 @test(i32* nocapture %ptr, i64 %a) { 19entry: 20 %conv = trunc i64 %a to i32 21 %0 = atomicrmw add i32* %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, i32* %ptr, align 4 25 ret i32 %1 26} 27