yonghong-song added inline comments.

================
Comment at: llvm/lib/Target/BPF/BPFInstrFormats.td:98
+
+def BPF_ATOMIC_FETCH : BPFAtomicFlag<0x1>;
 
----------------
jackmanb wrote:
> Per Alexei's email comments let's call this BPF_FETCH?
I can do this. Note naming in llvm may not be exactly the same as in kernel, 
but agree that we should keep it close.


================
Comment at: llvm/lib/Target/BPF/BPFInstrInfo.td:765
+      def XCHGB : XCHG<BPF_B, "8", atomic_swap_8>;
+      def XCHGH : XCHG<BPF_H, "16", atomic_swap_16>;
+      def XCHGW : XCHG<BPF_W, "32", atomic_swap_32>;
----------------
jackmanb wrote:
> I don't know if we want to define these for 16 and 8bit operands - XADD isn't 
> defined for those.
One of our original use cases is to do atomic operations with kernel data 
structures. For example, if the kernel may do xchg with char, short, it would 
be good for bpf to support it as well e.g., for bpf-cc (bpf congestion 
control), both bpf and kernel may do atomic operations on the same data 
structure.

I may add byte/half support to others (fetch_and_add, fetch_and_sub) as well if 
you reach consensus here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72184/new/

https://reviews.llvm.org/D72184

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to