[PATCH] D49396: [WebAssembly] Support for atomic.wait / atomic.wake builtins

Derek Schuff via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 31 16:36:02 PDT 2018

dschuff added inline comments.

Comment at: include/clang/Basic/BuiltinsWebAssembly.def:38
+// Atomic wait and wake.
+BUILTIN(__builtin_wasm_atomic_wait_i32, "Uii*iLLi", "n")
+BUILTIN(__builtin_wasm_atomic_wait_i64, "UiLLi*LLiLLi", "n")
So this means that the signature is basically `unsigned int __builtin_wasm_atomic_wait_i32(int *, int, long long)`? We should maybe make it `int __builtin_wasm_atomic_wait_i32(const unsigned char *, int, unsigned long long)`. Returning int so that you could define a C enum with the possible return values and compare without type coercion; unsigned char * so that it aliases with everything (i.e. a byte ptr), and unsigned long long since a negative relative timeout isn't meaningful(?). Not sure whether we should use int or unsigned int as the expected value, can't think of any particular reason right now to use one or the other.

Likewise with the other signatures.

  rC Clang


More information about the cfe-commits mailing list