summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCebtenzzre <cebtenzzre@gmail.com>2023-09-01 09:53:14 -0400
committerGitHub <noreply@github.com>2023-09-01 16:53:14 +0300
commit6c9c23429bf4e4fcaaddbebadc4638558430a7f2 (patch)
treef4a623a5e6d7f1ca359f8abe1c8df345d2993953
parentee8654bcd0146708988a703e54406d5b553712ea (diff)
make : use unaligned vector moves on MinGW (#2945)
Fixes #2922
-rw-r--r--Makefile8
1 files changed, 8 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ef1eef6a..23f050c0 100644
--- a/Makefile
+++ b/Makefile
@@ -177,6 +177,14 @@ ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
#CXXFLAGS += -mssse3
endif
+# The stack is only 16-byte aligned on Windows, so don't let gcc emit aligned moves.
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412
+# https://github.com/ggerganov/llama.cpp/issues/2922
+ifneq '' '$(findstring mingw,$(shell $(CC) -dumpmachine))'
+ CFLAGS += -Xassembler -muse-unaligned-vector-move
+ CXXFLAGS += -Xassembler -muse-unaligned-vector-move
+endif
+
ifneq ($(filter aarch64%,$(UNAME_M)),)
# Apple M1, M2, etc.
# Raspberry Pi 3, 4, Zero 2 (64-bit)