[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:42:34 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>;
----------------
eddyz87 wrote:

> Remove 'let mayStore = 1' in ATOMIC_NOFETCH. I am not whether this is needed or not. Previous class does not have this.

I think tablegen wanted me to add this flag when I added patterns. If it does not report warnings on you side, then ok.

> Remove 'MI.getOpcode() != BPF::XADDW32' in BPFMIChecking.cpp. XADDW32 is only available with alu32, in which case return value is okay.

`XADDW32` is not a member of any pattern, so I agree, this should be fine.

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


More information about the llvm-commits mailing list