Commit da5d38cb authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Add a patch for VC to workaround GCC unaligned stack bug

See original report for details:
https://github.com/VcDevel/Vc/issues/241

CCBUG:406209
parent 82ab7f9c
From 9cba6ee74397e2b3a6f1f225e2e716bf903bc7f0 Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Wed, 10 Apr 2019 11:03:29 +0300
Subject: [PATCH] Workaround AVX argument failures
Define Vector::AsArg to be a const reference. The interleave functions
already use AsArg.
Refs: gh-241
---
avx/vector.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/avx/vector.h b/avx/vector.h
index d815cd45..9858ed68 100644
--- a/avx/vector.h
+++ b/avx/vector.h
@@ -107,7 +107,15 @@ public:
SimdArray<int, Size, SSE::int_v, 4>,
SimdArray<int, Size, Scalar::int_v, 1>>::type IndexType;
#endif
+
+#if defined __WIN64__ && defined __GNUC__
+ // Passing Vector by value leads to misaligned loads and stores. This works around
+ // the bug https://github.com/VcDevel/Vc/issues/241
+ using AsArg = const Vector<T, abi> &;
+#else
typedef Vector<T, abi> AsArg;
+#endif
+
typedef VectorType VectorTypeArg;
protected:
--
2.20.1.windows.1
......@@ -12,7 +12,24 @@ if(APPLE)
UPDATE_COMMAND ""
)
else(APPLE)
elseif (WIN32)
ExternalProject_Add( ext_vc
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://github.com/VcDevel/Vc/releases/download/1.3.3/Vc-1.3.3.tar.gz
URL_HASH SHA1=3d3ddd29eca7c2b541fd8d0f00923e57f58d5ef0
PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/0001-Workaround-AVX-argument-failures.patch
INSTALL_DIR ${PREFIX_ext_vc}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${PREFIX_ext_vc} -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${GLOBAL_BUILD_TYPE} ${GLOBAL_PROFILE} -DCMAKE_SYSTEM_PROCESSOR=x86
UPDATE_COMMAND ""
)
else()
ExternalProject_Add( ext_vc
DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR}
URL https://github.com/VcDevel/Vc/releases/download/1.3.3/Vc-1.3.3.tar.gz
......@@ -24,4 +41,4 @@ else(APPLE)
UPDATE_COMMAND ""
)
endif(APPLE)
endif()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment