@@ -41,12 +41,22 @@ static_assert((UINTPTR_MAX == 4294967295U) ||
41
41
" We currently only support 32- or 64-bit platforms" );
42
42
43
43
#ifdef LIBC_COMPILER_IS_MSVC
44
-
44
+ # ifdef LIBC_TARGET_ARCH_IS_X86
45
45
namespace LIBC_NAMESPACE_DECL {
46
46
using generic_v128 = __m128i;
47
47
using generic_v256 = __m256i;
48
48
using generic_v512 = __m512i;
49
49
} // 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
50
60
51
61
#else
52
62
namespace LIBC_NAMESPACE_DECL {
@@ -159,7 +169,8 @@ template <typename T> struct Memset {
159
169
160
170
LIBC_INLINE static void block (Ptr dst, uint8_t value) {
161
171
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));
163
174
} else if constexpr (is_array_v<T>) {
164
175
using value_type = typename T::value_type;
165
176
const auto Splat = splat<value_type>(value);
0 commit comments