[clang] [clang] constexpr atomic builtins (__c11_atomic_OP and __atomic_OP) (PR #98756)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 13 05:53:05 PST 2025


Hana =?utf-8?q?Dusíková?= <hanicka at hanicka.net>,
Hana =?utf-8?q?Dusíková?= <hanicka at hanicka.net>,
Hana =?utf-8?q?Dusíková?= <hanicka at hanicka.net>,
Hana =?utf-8?q?Dusíková?= <hanicka at hanicka.net>,
Hana =?utf-8?q?Dusíková?= <hanicka at hanicka.net>,
Hana =?utf-8?q?Dusíková?= <hanicka at hanicka.net>,
Hana =?utf-8?q?Dusíková?= <hanicka at hanicka.net>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/98756 at github.com>


================
@@ -4340,6 +4340,18 @@ whole system, the current device, an OpenCL workgroup, wavefront, or just a
 single thread. If these are used on a target that does not support atomic
 scopes, then they will behave exactly as the standard GNU atomic builtins.
 
+Constant evaluatable atomic builtins
+------------------------------------
+
+Clang supports constant evaluation of all ``__c11_atomic_*`` and GCC-compatible 
+``__atomic_*`` builtins. Behaviour of identical as if evaluating these builtins
+in a single-threaded environment. 
+
+(Note the GCC-compatible ``__atomic_fetch_OP`` and ``__atomic_OP_fetch`` 
+builtins with a pointer argument operates as if pointer was pointing to bytes.
+Evaluating these builtins which would result in a non-aligned pointer to pointee
----------------
AaronBallman wrote:

```suggestion
builtins with a pointer argument operates as if the pointer was pointing to bytes.
Evaluating these builtins in a way which would result in a non-aligned pointer to pointee
```

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


More information about the cfe-commits mailing list