-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[libc][msvc] fix mathlib build on WoA #161258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,12 +41,22 @@ static_assert((UINTPTR_MAX == 4294967295U) || | |||||||||||||||
| "We currently only support 32- or 64-bit platforms"); | ||||||||||||||||
|
|
||||||||||||||||
| #ifdef LIBC_COMPILER_IS_MSVC | ||||||||||||||||
|
|
||||||||||||||||
| #ifdef LIBC_TARGET_ARCH_IS_X86 | ||||||||||||||||
| namespace LIBC_NAMESPACE_DECL { | ||||||||||||||||
| using generic_v128 = __m128i; | ||||||||||||||||
| using generic_v256 = __m256i; | ||||||||||||||||
| using generic_v512 = __m512i; | ||||||||||||||||
| } // namespace LIBC_NAMESPACE_DECL | ||||||||||||||||
| #else | ||||||||||||||||
| // Special handling when target does not have real vector types. | ||||||||||||||||
| // We can potentially use uint8x16_t etc. However, MSVC does not provide | ||||||||||||||||
| // subscript operation. | ||||||||||||||||
| namespace LIBC_NAMESPACE_DECL { | ||||||||||||||||
|
||||||||||||||||
| namespace LIBC_NAMESPACE_DECL { | |
| namespace LIBC_NAMESPACE_DECL { | |
| // MSVC-specific workaround: | |
| // On non-x86 targets, MSVC does not provide native vector types or subscriptable vector types | |
| // (such as uint8x16_t). As a workaround, we define these placeholder structs as aligned arrays | |
| // of uint8_t. These are used in place of native vector types when compiling with MSVC on | |
| // targets that lack real vector support. |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment mentions ADL (Argument-Dependent Lookup) but doesn't explain what specific ambiguity is being resolved. Consider expanding the comment to clarify which functions were conflicting and why the generic:: qualification is necessary.
| // Avoid ambiguous call due to ADL | |
| // Avoid ambiguous call due to ADL: There are multiple 'store' functions in different namespaces, | |
| // including a global 'store' and 'generic::store'. Without the 'generic::' qualification, | |
| // the compiler may be unable to resolve which 'store' to use due to argument-dependent lookup (ADL), | |
| // leading to ambiguity. Explicitly qualifying with 'generic::' ensures the correct function is called. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhuber6 enforcing the existence of
generic_v512looks suspicious. Do you know if this is really required?