From cf0fff3e3fc8e2f8a63cd08eaf9dc6ab63de1d42 Mon Sep 17 00:00:00 2001 From: Narek Galstyan Date: Mon, 13 May 2024 12:56:58 -0700 Subject: [PATCH] Add -march=native in clang compile flags to enable auto-vectorization Tested on Macbook Pro with 2.4 GHz Intel Core i9, Clang 15 Output of objdump on bench_cpp when these flags are present: postgres@4832feb5168c:/lantern_shared/third_party/usearch/build_release$ objdump -d ./bench_cpp | grep vzero | head 1cad3: c5 f8 77 vzeroupper 1cb1e: c5 f8 77 vzeroupper ... grep output is empty when the flags are not present --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16bd3ef58..7d7d5aad9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,8 @@ function (setup_target TARGET_NAME) -fPIC -pedantic -Wfatal-errors + -march=native + -ftree-vectorize # Don't complain if the for-loops were not vectorzied -Wpass-failed=transform-warning -fcolor-diagnostics