[libc-commits] [PATCH] D137868: [libc] Fix builtin definition for memory functions
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Nov 16 13:03:57 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGda5d00ad0cf4: [libc] Fix builtin definition for memory functions (authored by michaelrj).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137868/new/
https://reviews.llvm.org/D137868
Files:
libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
libc/src/string/CMakeLists.txt
libc/src/string/memory_utils/op_x86.h
Index: libc/src/string/memory_utils/op_x86.h
===================================================================
--- libc/src/string/memory_utils/op_x86.h
+++ libc/src/string/memory_utils/op_x86.h
@@ -20,15 +20,22 @@
#include "src/string/memory_utils/op_builtin.h"
#include "src/string/memory_utils/op_generic.h"
-#ifdef __SSE2__
+#if defined(__AVX512BW__) || defined(__AVX512F__) || defined(__AVX2__) || \
+ defined(__SSE2__)
#include <immintrin.h>
-#else
+#endif
+
// Define fake functions to prevent the compiler from failing on undefined
-// functions in case SSE2 is not present.
+// functions in case the CPU extension is not present.
+#ifndef __AVX512BW__
#define _mm512_cmpneq_epi8_mask(A, B) 0
-#define _mm_movemask_epi8(A) 0
+#endif
+#ifndef __AVX2__
#define _mm256_movemask_epi8(A) 0
-#endif // __SSE2__
+#endif
+#ifndef __SSE2__
+#define _mm_movemask_epi8(A) 0
+#endif
namespace __llvm_libc::x86 {
Index: libc/src/string/CMakeLists.txt
===================================================================
--- libc/src/string/CMakeLists.txt
+++ libc/src/string/CMakeLists.txt
@@ -355,7 +355,7 @@
add_bcmp(bcmp_x86_64_opt_sse2 COMPILE_OPTIONS -march=k8 REQUIRE SSE2)
add_bcmp(bcmp_x86_64_opt_sse4 COMPILE_OPTIONS -march=nehalem REQUIRE SSE4_2)
add_bcmp(bcmp_x86_64_opt_avx2 COMPILE_OPTIONS -march=haswell REQUIRE AVX2)
- add_bcmp(bcmp_x86_64_opt_avx512 COMPILE_OPTIONS -march=skylake-avx512 REQUIRE AVX512F)
+ add_bcmp(bcmp_x86_64_opt_avx512 COMPILE_OPTIONS -march=skylake-avx512 REQUIRE AVX512BW)
add_bcmp(bcmp_opt_host COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_NATIVE})
add_bcmp(bcmp)
else()
@@ -409,7 +409,7 @@
add_memcmp(memcmp_x86_64_opt_sse2 COMPILE_OPTIONS -march=k8 REQUIRE SSE2)
add_memcmp(memcmp_x86_64_opt_sse4 COMPILE_OPTIONS -march=nehalem REQUIRE SSE4_2)
add_memcmp(memcmp_x86_64_opt_avx2 COMPILE_OPTIONS -march=haswell REQUIRE AVX2)
- add_memcmp(memcmp_x86_64_opt_avx512 COMPILE_OPTIONS -march=skylake-avx512 REQUIRE AVX512F)
+ add_memcmp(memcmp_x86_64_opt_avx512 COMPILE_OPTIONS -march=skylake-avx512 REQUIRE AVX512BW)
add_memcmp(memcmp_opt_host COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_NATIVE})
add_memcmp(memcmp)
elseif(${LIBC_TARGET_ARCHITECTURE_IS_AARCH64})
Index: libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
+++ libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake
@@ -6,7 +6,7 @@
set(ALL_CPU_FEATURES "")
if(${LIBC_TARGET_ARCHITECTURE_IS_X86})
- set(ALL_CPU_FEATURES SSE2 SSE4_2 AVX2 AVX512F FMA)
+ set(ALL_CPU_FEATURES SSE2 SSE4_2 AVX2 AVX512F AVX512BW FMA)
set(LIBC_COMPILE_OPTIONS_NATIVE -march=native)
elseif(${LIBC_TARGET_ARCHITECTURE_IS_AARCH64})
set(LIBC_COMPILE_OPTIONS_NATIVE -mcpu=native)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137868.475901.patch
Type: text/x-patch
Size: 2903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221116/a56291af/attachment-0001.bin>
More information about the libc-commits
mailing list