Open
Description
MSVC 14.43 introduces a hard requirement for these 2 compiler intrinsics: _CountLeadingZeros()
and _CountLeadingZeros64(_Val)
on ARM64. These were implemented in Clang 18 in this PR. Unlike the "soft" requirement in yvals_core.h
, there is no compiler define that we can use to work around this issue.
As a result, the Swift Windows ARM64 toolchain can not be built using the 6.0 toolchain as a bootstrap when using MSVC 14.43 or higher.
Possible solutions:
- Switch to a 6.1 toolchain for bootstrapping.
- Cherry-pick this PR to 6.0 and do a new release.
Here is the build failure log:
<module-includes>:29:10: note: in file included from <module-includes>:29:
27 | #include "array"
28 | #include "atomic"
29 | #include "bitset"
| `- note: in file included from <module-includes>:29:
30 | #include "charconv"
31 | #include "chrono"
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include/bitset:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include/bitset:10:
8 | #include <yvals_core.h>
9 | #if _STL_COMPILER_PREPROCESSOR
10 | #include <__msvc_bit_utils.hpp>
| `- note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include/bitset:10:
11 | #include <iosfwd>
12 | #include <xstring>
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\__msvc_bit_utils.hpp:138:33: error: use of undeclared identifier '_CountLeadingZeros'
136 |
137 | if constexpr (_Digits <= 32) {
138 | return static_cast<int>(_CountLeadingZeros(_Val)) - (_Unsigned_integer_digits<unsigned long> - _Digits);
| `- error: use of undeclared identifier '_CountLeadingZeros'
139 | } else {
140 | return static_cast<int>(_CountLeadingZeros64(_Val));
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\__msvc_int128.hpp:61:16: note: in instantiation of function template specialization 'std::_Checked_arm_arm64_countl_zero<unsigned int>' requested here
59 | #elif defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64)
60 | if (!_Is_constant_evaluated()) {
61 | return _Checked_arm_arm64_countl_zero(_Val);
| `- note: in instantiation of function template specialization 'std::_Checked_arm_arm64_countl_zero<unsigned int>' requested here
62 | }
63 | #endif // defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64)
<module-includes>:29:10: note: in file included from <module-includes>:29:
27 | #include "array"
28 | #include "atomic"
29 | #include "bitset"
| `- note: in file included from <module-includes>:29:
30 | #include "charconv"
31 | #include "chrono"
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include/bitset:10:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include/bitset:10:
8 | #include <yvals_core.h>
9 | #if _STL_COMPILER_PREPROCESSOR
10 | #include <__msvc_bit_utils.hpp>
| `- note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include/bitset:10:
11 | #include <iosfwd>
12 | #include <xstring>
<unknown>:0: error: could not build C module 'std'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\__msvc_bit_utils.hpp:140:33: error: use of undeclared identifier '_CountLeadingZeros64'
138 | return static_cast<int>(_CountLeadingZeros(_Val)) - (_Unsigned_integer_digits<unsigned long> - _Digits);
139 | } else {
140 | return static_cast<int>(_CountLeadingZeros64(_Val));
| `- error: use of undeclared identifier '_CountLeadingZeros64'
141 | }
142 | }
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\include\__msvc_int128.hpp:61:16: note: in instantiation of function template specialization 'std::_Checked_arm_arm64_countl_zero<unsigned long long>' requested here
59 | #elif defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64)
60 | if (!_Is_constant_evaluated()) {
61 | return _Checked_arm_arm64_countl_zero(_Val);
| `- note: in instantiation of function template specialization 'std::_Checked_arm_arm64_countl_zero<unsigned long long>' requested here
62 | }
63 | #endif // defined(_M_ARM) || defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64)
Metadata
Metadata
Assignees
Labels
No labels