@@ -41,12 +41,22 @@ static_assert((UINTPTR_MAX == 4294967295U) ||
4141 " We currently only support 32- or 64-bit platforms" );
4242
4343#ifdef LIBC_COMPILER_IS_MSVC
44-
44+ # ifdef LIBC_TARGET_ARCH_IS_X86
4545namespace LIBC_NAMESPACE_DECL {
4646using generic_v128 = __m128i;
4747using generic_v256 = __m256i;
4848using generic_v512 = __m512i;
4949} // namespace LIBC_NAMESPACE_DECL
50+ #else
51+ // Special handling when target does not have real vector types.
52+ // We can potentially use uint8x16_t etc. However, MSVC does not provide
53+ // subscript operation.
54+ namespace LIBC_NAMESPACE_DECL {
55+ struct alignas (16 ) generic_v128 : public cpp::array<uint8_t , 16 > {};
56+ struct alignas (32 ) generic_v256 : public cpp::array<uint8_t , 32 > {};
57+ struct alignas (64 ) generic_v512 : public cpp::array<uint8_t , 64 > {};
58+ } // namespace LIBC_NAMESPACE_DECL
59+ #endif
5060
5161#else
5262namespace LIBC_NAMESPACE_DECL {
@@ -159,7 +169,8 @@ template <typename T> struct Memset {
159169
160170 LIBC_INLINE static void block (Ptr dst, uint8_t value) {
161171 if constexpr (is_scalar_v<T> || is_vector_v<T>) {
162- store<T>(dst, splat<T>(value));
172+ // Avoid ambiguous call due to ADL
173+ generic::store<T>(dst, splat<T>(value));
163174 } else if constexpr (is_array_v<T>) {
164175 using value_type = typename T::value_type;
165176 const auto Splat = splat<value_type>(value);
0 commit comments