r364137 - builtins: relax __iso_volatile_{load,store}32
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 22 11:55:51 PDT 2019
Author: compnerd
Date: Sat Jun 22 11:55:51 2019
New Revision: 364137
URL: http://llvm.org/viewvc/llvm-project?rev=364137&view=rev
Log:
builtins: relax __iso_volatile_{load,store}32
This is reduced from MSVC's MSVCPRT 14.21.27702 atomic header. Because
Windows is a LLP64 environment, `long`, `long int`, and `int` are all
synonymous. Change the signature for `__iso_volatile_load32` and
`__iso_volatile_store32` to accept a `long int` instead. This allows
an implicit cast of `int` to `long int` while also permitting `long`
to be accepted.
Added:
cfe/trunk/test/CodeGenCXX/ms-intrinsics.cpp
Modified:
cfe/trunk/include/clang/Basic/Builtins.def
Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=364137&r1=364136&r2=364137&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Sat Jun 22 11:55:51 2019
@@ -827,11 +827,11 @@ LANGBUILTIN(_interlockedbittestandset_nf
LANGBUILTIN(_interlockedbittestandset_rel, "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_load8, "ccCD*", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_load16, "ssCD*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_load32, "iiCD*", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_load32, "LiLiCD*", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_load64, "LLiLLiCD*", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_store8, "vcD*c", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_store16, "vsD*s", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_store32, "viD*i", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(__iso_volatile_store32, "vLiD*Li", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__iso_volatile_store64, "vLLiD*LLi", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__noop, "i.", "n", ALL_MS_LANGUAGES)
LANGBUILTIN(__lzcnt16, "UsUs", "nc", ALL_MS_LANGUAGES)
Added: cfe/trunk/test/CodeGenCXX/ms-intrinsics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/ms-intrinsics.cpp?rev=364137&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/ms-intrinsics.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/ms-intrinsics.cpp Sat Jun 22 11:55:51 2019
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fms-compatibility -fsyntax-only %s -verify
+// expected-no-diagnostics
+
+struct S {
+ mutable long _Spinlock = 0;
+ void _Unlock() {
+ __iso_volatile_store32(&_Spinlock, 0);
+ }
+ int _Reset() {
+ long v = __iso_volatile_load32(&_Spinlock);
+ __iso_volatile_store32(&_Spinlock, 0);
+ return v;
+ }
+};
+
+S s;
+
More information about the cfe-commits
mailing list