diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h --- a/libc/src/string/memory_utils/op_x86.h +++ b/libc/src/string/memory_utils/op_x86.h @@ -20,15 +20,21 @@ #include "src/string/memory_utils/op_builtin.h" #include "src/string/memory_utils/op_generic.h" -#ifdef __SSE2__ +#if defined(__AVX512F__) || defined(__SSE2__) || defined(__AVX2__) #include -#else +#endif + // Define fake functions to prevent the compiler from failing on undefined -// functions in case SSE2 is not present. +// functions in case the builtin is not present. +#ifndef __AVX512F__ #define _mm512_cmpneq_epi8_mask(A, B) 0 +#endif // __AVX512F__ +#ifndef __SSE2__ #define _mm_movemask_epi8(A) 0 -#define _mm256_movemask_epi8(A) 0 #endif // __SSE2__ +#ifndef __AVX2__ +#define _mm256_movemask_epi8(A) 0 +#endif // __AVX2__ namespace __llvm_libc::x86 {