[llvm] BPF: Generate locked insn for __sync_fetch_and_add() with cpu v1/v2 (PR #106494)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 10:13:04 PDT 2024
================
@@ -1,19 +1,22 @@
-; RUN: llc < %s -march=bpfel -verify-machineinstrs -show-mc-encoding | FileCheck --check-prefixes=CHECK,CHECK-V2 %s
-; RUN: llc < %s -march=bpfel -verify-machineinstrs -show-mc-encoding -mcpu=v3 | FileCheck --check-prefixes=CHECK,CHECK-V3 %s
+; RUN: llc < %s -march=bpfel -verify-machineinstrs -show-mc-encoding | FileCheck %s
----------------
yonghong-song wrote:
We can do this. This may cause verification failure or other things from v1 to v3. I guess we can have a separate patch just to flip the default. I can then post it to bpf mailing list to let people know.
Regarding to selftests, current in llvm/test/CodeGen/BPF directory (not including sub-directory), we only '-mcpu=v1' for llvm-objdump since llvm-objdump has been improved to dump insn based on cpu v4.
Otherwise, -mcpu=v1 is the default and not specified in the test.
```
[~/work/llvm-project/llvm/test/CodeGen/BPF (main)]$ grep "mcpu=v1" *.ll
objdump_cond_op.ll:; RUN: llc -mtriple=bpfel -filetype=obj -o - %s | llvm-objdump --no-print-imm-hex --mcpu=v1 -d - | FileCheck %s
objdump_static_var.ll:; RUN: llc -mtriple=bpfel -filetype=obj -o - %s | llvm-objdump --no-print-imm-hex --mcpu=v1 -d - | FileCheck --check-prefix=CHECK %s
objdump_static_var.ll:; RUN: llc -mtriple=bpfeb -filetype=obj -o - %s | llvm-objdump --no-print-imm-hex --mcpu=v1 -d - | FileCheck --check-prefix=CHECK %s
[~/work/llvm-project/llvm/test/CodeGen/BPF (main)]$
```
Later when we want to make cpu v3 as the default, all related tests can be modified at that time.
https://github.com/llvm/llvm-project/pull/106494
More information about the llvm-commits
mailing list