[clang] [llvm] [BPF] Add load-acquire and store-release instructions under -mcpu=v4 (PR #108636)

via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 3 17:39:01 PST 2024


yonghong-song wrote:

> Sure Yonghong, I can include that in this PR. Similarly, since we cannot have both `relaxed_load<atomic_load_zext_{8,16}>` and `relaxed_load<atomic_load_sext_{8,16}>`, I'll keep it `zext` (`BPF_MEM` | `BPF_LDX`) for now. For example:
> 
> ```c
> int foo(char *ptr) {
>     return __atomic_load_n(ptr, __ATOMIC_RELAXED);
> }
> ```
> 
> This'll be compiled into:
> 
> ```
> 0000000000000000 <foo>:
>        0:	71 11 00 00 00 00 00 00	w1 = *(u8 *)(r1 + 0x0)
>        1:	bc 10 08 00 00 00 00 00	w0 = (s8)w1
>        2:	95 00 00 00 00 00 00 00	exit
> ```

Okay, LGTM. Thanks!

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


More information about the cfe-commits mailing list