|
15 | 15 | #include "src/__support/macros/attributes.h" // LIBC_INLINE
|
16 | 16 | #include "src/__support/macros/config.h" // LIBC_NAMESPACE_DECL
|
17 | 17 | #include "src/__support/macros/properties/architectures.h"
|
| 18 | +#include "src/__support/macros/properties/compiler.h" |
18 | 19 |
|
19 | 20 | #if defined(LIBC_TARGET_ARCH_IS_X86)
|
20 | 21 |
|
@@ -57,7 +58,12 @@ LIBC_INLINE_VAR constexpr bool K_AVX512_BW = LLVM_LIBC_IS_DEFINED(__AVX512BW__);
|
57 | 58 | // Memcpy repmovsb implementation
|
58 | 59 | struct Memcpy {
|
59 | 60 | LIBC_INLINE static void repmovsb(void *dst, const void *src, size_t count) {
|
| 61 | +#ifdef LIBC_COMPILER_IS_MSVC |
| 62 | + __movsb(static_cast<unsigned char *>(dst), |
| 63 | + static_cast<const unsigned char *>(src), count); |
| 64 | +#else |
60 | 65 | asm volatile("rep movsb" : "+D"(dst), "+S"(src), "+c"(count) : : "memory");
|
| 66 | +#endif // LIBC_COMPILER_IS_MSVC |
61 | 67 | }
|
62 | 68 | };
|
63 | 69 |
|
@@ -138,8 +144,10 @@ LIBC_INLINE MemcmpReturnType cmp_neq<uint64_t>(CPtr p1, CPtr p2,
|
138 | 144 | // When we use these SIMD types in template specialization GCC complains:
|
139 | 145 | // "ignoring attributes on template argument ‘__m128i’ [-Wignored-attributes]"
|
140 | 146 | // Therefore, we disable this warning in this file.
|
| 147 | +#ifndef LIBC_COMPILER_IS_MSVC |
141 | 148 | #pragma GCC diagnostic push
|
142 | 149 | #pragma GCC diagnostic ignored "-Wignored-attributes"
|
| 150 | +#endif // !LIBC_COMPILER_IS_MSVC |
143 | 151 |
|
144 | 152 | ///////////////////////////////////////////////////////////////////////////////
|
145 | 153 | // Specializations for __m128i
|
@@ -366,7 +374,9 @@ LIBC_INLINE MemcmpReturnType cmp_neq<__m512i>(CPtr p1, CPtr p2, size_t offset) {
|
366 | 374 | }
|
367 | 375 | #endif // __AVX512BW__
|
368 | 376 |
|
| 377 | +#ifndef LIBC_COMPILER_IS_MSVC |
369 | 378 | #pragma GCC diagnostic pop
|
| 379 | +#endif // !LIBC_COMPILER_IS_MSVC |
370 | 380 |
|
371 | 381 | } // namespace generic
|
372 | 382 | } // namespace LIBC_NAMESPACE_DECL
|
|
0 commit comments