From 382d464952a6444d3bcbe7406e444ba4af0c0bb8 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sat, 16 Oct 2021 10:39:49 -0700 Subject: [PATCH] math: fix linker error --- app/node/math/math/mathbase.cpp | 53 ++++++++++++++------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/app/node/math/math/mathbase.cpp b/app/node/math/math/mathbase.cpp index 420ad4ac9..f488c4bb1 100644 --- a/app/node/math/math/mathbase.cpp +++ b/app/node/math/math/mathbase.cpp @@ -175,7 +175,6 @@ void MathNodeBase::PerformAllOnFloatBuffer(Operation operation, float *a, float } #ifdef Q_PROCESSOR_X86 -typedef __m128 (*SSEOperationFunction)(__m128 a, __m128 b); void MathNodeBase::PerformAllOnFloatBufferSSE(Operation operation, float *a, float b, int start, int end) { int end_divisible_4 = (end / 4) * 4; @@ -183,43 +182,37 @@ void MathNodeBase::PerformAllOnFloatBufferSSE(Operation operation, float *a, flo // Load number to multiply by into buffer __m128 mult = _mm_load1_ps(&b); - SSEOperationFunction func = nullptr; switch (operation) { case kOpAdd: - func = _mm_add_ps; - break; - case kOpSubtract: - func = _mm_sub_ps; - break; - case kOpMultiply: - func = _mm_mul_ps; - break; - case kOpDivide: - func = _mm_div_ps; - break; - case kOpPower: - // Leave as nullptr, which will fallback to non-SSE operation - break; - } - - if (func) { - // If we have an SSE version of this operation, do this now - // Loop all values for(int j = 0; j < end_divisible_4; j+=4) { - __m128 cur = _mm_loadu_ps(a + start + j); - __m128 res = func(cur, mult); - _mm_storeu_ps(a + start + j, res); + _mm_storeu_ps(a + start + j, _mm_add_ps(_mm_loadu_ps(a + start + j), mult)); } - - // Do last three numbers, if non-divisible by 4 - for (int j=end_divisible_4; j