[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
Fri Aug 30 11:21:23 PDT 2024


================
@@ -806,6 +806,7 @@ class XADD<BPFWidthModifer SizeOp, string OpcodeStr, PatFrag OpNode>
 let Constraints = "$dst = $val" in {
   let Predicates = [BPFNoALU32] in {
     def XADDW : XADD<BPF_W, "u32", atomic_load_add_i32>;
+    def XADDD : XADD<BPF_DW, "u64", atomic_load_add_i64>;
----------------
yonghong-song wrote:

@eddyz87 What you suggested indeed simpler and I just incorporated it into the latest revision. I made two changes:
  - Remove 'let mayStore = 1' in ATOMIC_NOFETCH. I am not whether this is needed or not. Previous class does not have this.
  - Remove 'MI.getOpcode() != BPF::XADDW32' in BPFMIChecking.cpp. XADDW32 is only available with alu32, in which case return value is okay.

Please help take a look again in case that I missed anything. Thanks!

https://github.com/llvm/llvm-project/pull/106494


More information about the llvm-commits mailing list