[PATCH] D12862: [WebAssembly] Define the atomic type sizes
sunfish created this revision. sunfish added a reviewer: jfb. sunfish added a subscriber: cfe-commits. sunfish set the repository for this revision to rL LLVM. Herald added subscribers: dschuff, jfb. WebAssembly's spec has now been updated to specify some [guarantees about lock free atomic accesses](https://github.com/WebAssembly/design/pull/336). Update clang to match. This also updates sig_atomic_t to be 64-bit on wasm64. WebAssembly does not presently have asynchronous interrupts, but this change is within the spirit of how they will work if they are added. Repository: rL LLVM http://reviews.llvm.org/D12862 Files: lib/Basic/Targets.cpp test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -8472,17 +8472,17 @@ // WEBASSEMBLY32-NEXT:#define __FLT_MIN_EXP__ (-125){{$}} // WEBASSEMBLY32-NEXT:#define __FLT_MIN__ 1.17549435e-38F{{$}} // WEBASSEMBLY32-NEXT:#define __FLT_RADIX__ 2{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 1{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 2{{$}} // WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2{{$}} // WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2{{$}} // WEBASSEMBLY32-NEXT:#define __GNUC_MINOR__ {{.}} // WEBASSEMBLY32-NEXT:#define __GNUC_PATCHLEVEL__ {{.}} // WEBASSEMBLY32-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}} @@ -8586,7 +8586,7 @@ // WEBASSEMBLY32-NOT:#define __REGISTER_PREFIX__ // WEBASSEMBLY32-NEXT:#define __SCHAR_MAX__ 127{{$}} // WEBASSEMBLY32-NEXT:#define __SHRT_MAX__ 32767{{$}} -// WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_MAX__ 2147483647{{$}} +// WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_MAX__ 2147483647L{{$}} // WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_WIDTH__ 32{{$}} // WEBASSEMBLY32-NEXT:#define __SIZEOF_DOUBLE__ 8{{$}} // WEBASSEMBLY32-NEXT:#define __SIZEOF_FLOAT__ 4{{$}} @@ -8788,17 +8788,17 @@ // WEBASSEMBLY64-NEXT:#define __FLT_MIN_EXP__ (-125){{$}} // WEBASSEMBLY64-NEXT:#define __FLT_MIN__ 1.17549435e-38F{{$}} // WEBASSEMBLY64-NEXT:#define __FLT_RADIX__ 2{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2{{$}} // WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2{{$}} // WEBASSEMBLY64-NEXT:#define __GNUC_MINOR__ {{.}} // WEBASSEMBLY64-NEXT:#define __GNUC_PATCHLEVEL__ {{.}} // WEBASSEMBLY64-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}} @@ -8902,8 +8902,8 @@ // WEBASSEMBLY64-NOT:#define __REGISTER_PREFIX__ // WEBASSEMBLY64-NEXT:#define __SCHAR_MAX__ 127{{$}} // WEBASSEMBLY64-NEXT:#define
Re: [PATCH] D12862: [WebAssembly] Define the atomic type sizes
jfb accepted this revision. jfb added a comment. This revision is now accepted and ready to land. lgtm Repository: rL LLVM http://reviews.llvm.org/D12862 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12862: [WebAssembly] Define the atomic type sizes
This revision was automatically updated to reflect the committed changes. Closed by commit rL247624: [WebAssembly] Define the atomic type sizes (authored by djg). Changed prior to commit: http://reviews.llvm.org/D12862?vs=34731&id=34739#toc Repository: rL LLVM http://reviews.llvm.org/D12862 Files: cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/test/Preprocessor/init.c Index: cfe/trunk/test/Preprocessor/init.c === --- cfe/trunk/test/Preprocessor/init.c +++ cfe/trunk/test/Preprocessor/init.c @@ -8472,17 +8472,17 @@ // WEBASSEMBLY32-NEXT:#define __FLT_MIN_EXP__ (-125){{$}} // WEBASSEMBLY32-NEXT:#define __FLT_MIN__ 1.17549435e-38F{{$}} // WEBASSEMBLY32-NEXT:#define __FLT_RADIX__ 2{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 1{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 2{{$}} // WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2{{$}} // WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1{{$}} -// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1{{$}} +// WEBASSEMBLY32-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2{{$}} // WEBASSEMBLY32-NEXT:#define __GNUC_MINOR__ {{.}} // WEBASSEMBLY32-NEXT:#define __GNUC_PATCHLEVEL__ {{.}} // WEBASSEMBLY32-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}} @@ -8586,7 +8586,7 @@ // WEBASSEMBLY32-NOT:#define __REGISTER_PREFIX__ // WEBASSEMBLY32-NEXT:#define __SCHAR_MAX__ 127{{$}} // WEBASSEMBLY32-NEXT:#define __SHRT_MAX__ 32767{{$}} -// WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_MAX__ 2147483647{{$}} +// WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_MAX__ 2147483647L{{$}} // WEBASSEMBLY32-NEXT:#define __SIG_ATOMIC_WIDTH__ 32{{$}} // WEBASSEMBLY32-NEXT:#define __SIZEOF_DOUBLE__ 8{{$}} // WEBASSEMBLY32-NEXT:#define __SIZEOF_FLOAT__ 4{{$}} @@ -8788,17 +8788,17 @@ // WEBASSEMBLY64-NEXT:#define __FLT_MIN_EXP__ (-125){{$}} // WEBASSEMBLY64-NEXT:#define __FLT_MIN__ 1.17549435e-38F{{$}} // WEBASSEMBLY64-NEXT:#define __FLT_RADIX__ 2{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 1{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_BOOL_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_CHAR_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_INT_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LLONG_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_LONG_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2{{$}} // WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1{{$}} -// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 1{{$}} +// WEBASSEMBLY64-NEXT:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2{{$}} // WEBASSEMBLY64-NEXT:#define __GNUC_MINOR__ {{.}} // WEBASSEMBLY64-NEXT:#define __GNUC_PATCHLEVEL__ {{.}} // WEBASSEMBLY64-NEXT:#define __GNUC_STDC_INLINE__ 1{{$}} @@ -8902,8 +8902,8 @@ // WEBASSEMBLY64-NOT:#define __REGISTER_PREFIX__ // WEBASSEMBLY64-NEXT:#define __SCHAR_MAX__ 127{{$}} // WEBASSEMBLY64-NEXT:#define __SHRT_MAX__ 32767{{$}} -// WEBASSEMBLY64-NEXT:#define __SIG_ATOMIC_MAX__ 2147483647{{$}} -// WEBASSEMBLY64-NEXT:#define __SIG_ATOMIC_WIDTH__ 32{{$}} +// WEBASSEMBLY64-NEXT:#define __SIG_ATOMIC_MAX__ 9223372036854775807L{{$}} +// WEBASSEMBLY64-NEXT:#define __SIG_ATOMIC_WIDTH__