yonghong-song wrote:

I remembered I mentioned earlier that for __ATOMIC_RELAXED, we should just use 
plain load/store. But I have the following example,

```
[yhs@devbig309.ftw3 ~/tmp4]$ cat atomic.c
long bar(unsigned char *ptr) {
    return __atomic_load_n(ptr, __ATOMIC_RELAXED);
}
$ llvm-objdump -d atomic.o

atomic.o:       file format elf64-bpf

Disassembly of section .text:

0000000000000000 <bar>:
       0:       d3 10 00 00 12 00 00 00 w0 = load_acquire((u8 *)(r1 + 0x0))
       1:       95 00 00 00 00 00 00 00 exit
$
```

For fetch_and_*() operations if it is __ATOMIC_RELAXED, the code will be 
different from other atomic flavor.
I think for load_acquire and store_release case, we should not use 
load_acquire/store_release if it is __ATOMIC_RELAXED, and should just use plain 
load and store.

https://github.com/llvm/llvm-project/pull/108636
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to