<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Add _InterlockedIncrement64 and other intrinsic for x86 for parity with MSVC"
href="https://bugs.llvm.org/show_bug.cgi?id=46595">46595</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Add _InterlockedIncrement64 and other intrinsic for x86 for parity with MSVC
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gutenev@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>The following intrinsic functions were recently added to MSVC for x86:
__MACHINE(__int64 _InterlockedAnd64(__int64 volatile * _Value, __int64 _Mask))
__MACHINE(__int64 _InterlockedDecrement64(__int64 volatile * _Addend))
__MACHINE(__int64 _InterlockedExchange64(__int64 volatile * _Target, __int64
_Value))
__MACHINE(__int64 _InterlockedExchangeAdd64(__int64 volatile * _Addend, __int64
_Value))
__MACHINE(__int64 _InterlockedIncrement64(__int64 volatile * _Addend))
__MACHINE(__int64 _InterlockedOr64(__int64 volatile * _Value, __int64 _Mask))
__MACHINE(__int64 _InterlockedXor64(__int64 volatile * _Value, __int64 _Mask))
They are implemented using lock cmpxchg8b. However, this implementation is
still expected to be more efficient than direct _InterlockedCompareExchange64
The following are exact steps to see the absence of _InterlockedIncrement64
on x86 in clang-cl:
d:\Temp2>"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\bin\Hostx86\x86\cl.exe"
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29009.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
d:\Temp2>"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Preview\VC\Tools\Llvm\bin\clang-cl.exe" --version
clang version 10.0.0
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files (x86)\Microsoft Visual
Studio\2019\Preview\VC\Tools\Llvm\bin
d:\Temp2>type repro.cpp
#include <intrin.h>
volatile long long i = 0;
int main()
{
_InterlockedIncrement64(&i);
}
d:\Temp2>"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Preview\VC\Tools\MSVC\14.27.29009\bin\Hostx86\x86\cl.exe" repro.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29009.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
repro.cpp
Microsoft (R) Incremental Linker Version 14.27.29009.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:repro.exe
repro.obj
d:\Temp2>"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Preview\VC\Tools\Llvm\bin\clang-cl.exe" repro.cpp
repro.cpp(7,5): error: use of undeclared identifier '_InterlockedIncrement64'
_InterlockedIncrement64(&i);
^
1 error generated.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>