[llvm] [IR] Add elementwise modifier to atomic loads (PR #204556)

Harrison Hao via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 00:08:40 PDT 2026


================
@@ -12037,11 +12037,20 @@ If the ``load`` is marked as ``atomic``, it takes an extra :ref:`ordering
 Atomic loads produce :ref:`defined <memmodel>` results when they may see
 multiple atomic stores. The type of the pointee must be an integer, pointer,
 floating-point, or vector type whose bit width is a power of two greater than
-or equal to eight. ``align`` must be
-explicitly specified on atomic loads. Note: if the alignment is not greater or
-equal to the size of the `<value>` type, the atomic operation is likely to
-require a lock and have poor performance. ``!nontemporal`` does not have any
-defined semantics for atomic loads.
+or equal to eight.
+
+If the ``elementwise`` modifier is present, the loaded type must be a fixed
+vector type, and each element type must be a valid scalar atomic load type. The
----------------
harrisonGPU wrote:

For example, scalar integer types such as i1, i2, i4, i7, or i24 are not valid scalar atomic load types, because the bit width is either less than 8 or not a power of two.

I think this is still useful to state for elementwise vector atomics. The existing load wording requires the load type to be valid, it said: `The type of the pointee must be an integer, pointer,
floating-point, or vector type whose bit width is a power of two greater than
or equal to eight.`, but for elementwise vector atomic loads/stores we should make it clear that the restriction applies to each element type, not only to the total vector type. 
What do you think about?

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


More information about the llvm-commits mailing list