[llvm] [LangRef] Rewrite the elementwise atomic description and reject seq_cst elementwise atomics (PR #209931)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 05:14:16 PDT 2026


================
@@ -4181,6 +4181,29 @@ Otherwise, an atomic operation that is not marked
 monotonic modification order with other operations that are not marked
 `syncscope("singlethread")` or `syncscope("<target-scope>")`.
 
+(elementwise-atomics)=
+
+### Elementwise Atomic Operations
+
+Certain atomic instructions, such as {ref}`atomicrmw <i_atomicrmw>`,
+and {ref}`atomic load <i_load>`, may be marked `elementwise`. The access type
+must then be a fixed vector type whose total bit width is a power of two greater
+than or equal to eight, and whose element type is supported by the corresponding
+scalar atomic instruction.
+
+For the purposes of the happens-before relation, the instruction behaves as if
----------------
antoniofrighetto wrote:

Considering that happens-before does encompass program order, and that the happens-before relation is defined a few lines earlier, I'd suggest not introducing C++ terms (sequenced-before) that LangRef doesn't otherwise use. If the shorter form doesn't suffice:

```suggestion
For the purposes of the memory model, the instruction behaves as if
```
Perhaps an explicit refinement could go along the following lines:
``` 
The scalar operations of a single elementwise instruction are not related to
one another by program order; consequently, the instruction does not, by
itself, establish any happens-before relationship among them.
```

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


More information about the llvm-commits mailing list