From 50d5c3a80e702c0ccab0b505cfaa4d5a62cb1cef Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Mon, 1 Jun 2020 09:52:17 +0200 Subject: [PATCH] Brainfart on the ifdef --- src/sfizz/simd/HelpersAVX.cpp | 8 +++---- src/sfizz/simd/HelpersSSE.cpp | 40 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/sfizz/simd/HelpersAVX.cpp b/src/sfizz/simd/HelpersAVX.cpp index 9ca89a65..cad8c2aa 100644 --- a/src/sfizz/simd/HelpersAVX.cpp +++ b/src/sfizz/simd/HelpersAVX.cpp @@ -9,8 +9,8 @@ #include "../MathHelpers.h" #include "Common.h" -#ifdef SFIZZ_HAVE_AVX -#include "immintrin.h" +#if SFIZZ_HAVE_AVX +#include using Type = float; constexpr unsigned TypeAlignment = 8; constexpr unsigned ByteAlignment = TypeAlignment * sizeof(Type); @@ -20,7 +20,7 @@ void applyGainAVX(float gain, const float* input, float* output, unsigned size) { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_AVX +#if SFIZZ_HAVE_AVX const auto* lastAligned = prevAligned(sentinel); const auto mmGain = _mm256_set1_ps(gain); while (unaligned(input, output) && output < lastAligned) @@ -40,7 +40,7 @@ void applyGainAVX(const float* gain, const float* input, float* output, unsigned { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_AVX +#if SFIZZ_HAVE_AVX const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) *output++ = (*gain++) * (*input++); diff --git a/src/sfizz/simd/HelpersSSE.cpp b/src/sfizz/simd/HelpersSSE.cpp index bacda811..5f51e590 100644 --- a/src/sfizz/simd/HelpersSSE.cpp +++ b/src/sfizz/simd/HelpersSSE.cpp @@ -5,13 +5,13 @@ // If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz #include "HelpersSSE.h" -#include "../MathHelpers.h" #include "../SIMDConfig.h" +#include "../MathHelpers.h" #include "Common.h" #include -#ifdef SFIZZ_HAVE_SSE -#include "emmintrin.h" +#if SFIZZ_HAVE_SSE2 +#include using Type = float; constexpr unsigned TypeAlignment = 4; constexpr unsigned ByteAlignment = TypeAlignment * sizeof(Type); @@ -21,7 +21,7 @@ void readInterleavedSSE(const float* input, float* outputLeft, float* outputRigh { const auto sentinel = input + inputSize - 1; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(input + inputSize - TypeAlignment); while (unaligned(input, outputLeft, outputRight) && input < lastAligned) { *outputLeft++ = *input++; @@ -58,7 +58,7 @@ void writeInterleavedSSE(const float* inputLeft, const float* inputRight, float* { const auto sentinel = output + outputSize - 1; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(output + outputSize - TypeAlignment); while (unaligned(output, inputRight, inputLeft) && output < lastAligned) { *output++ = *inputLeft++; @@ -86,7 +86,7 @@ void applyGainSSE(float gain, const float* input, float* output, unsigned size) { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); const auto mmGain = _mm_set1_ps(gain); while (unaligned(input, output) && output < lastAligned) @@ -106,7 +106,7 @@ void applyGainSSE(const float* gain, const float* input, float* output, unsigned { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) *output++ = (*gain++) * (*input++); @@ -143,7 +143,7 @@ void multiplyAddSSE(const float* gain, const float* input, float* output, unsign { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) *output++ += (*gain++) * (*input++); @@ -164,7 +164,7 @@ void multiplyAddSSE(float gain, const float* input, float* output, unsigned size { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) *output++ += gain * (*input++); @@ -186,7 +186,7 @@ float linearRampSSE(float* output, float start, float step, unsigned size) noexc { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(output) && output < lastAligned) { *output++ = start; @@ -215,7 +215,7 @@ float multiplicativeRampSSE(float* output, float start, float step, unsigned siz { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(output) && output < lastAligned) { *output++ = start; @@ -244,7 +244,7 @@ void addSSE(const float* input, float* output, unsigned size) noexcept { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) *output++ += *input++; @@ -263,7 +263,7 @@ void addSSE(float value, float* output, unsigned size) noexcept { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(output) && output < lastAligned) *output++ += value; @@ -283,7 +283,7 @@ void subtractSSE(const float* input, float* output, unsigned size) noexcept { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) *output++ -= *input++; @@ -302,7 +302,7 @@ void subtractSSE(float value, float* output, unsigned size) noexcept { const auto sentinel = output + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(output) && output < lastAligned) *output++ -= value; @@ -323,7 +323,7 @@ void copySSE(const float* input, float* output, unsigned size) noexcept // The sentinel is the input here const auto sentinel = input + size; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && input < lastAligned) *output++ = *input++; @@ -345,7 +345,7 @@ float meanSSE(const float* vector, unsigned size) noexcept if (size == 0) return result; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(vector) && vector < lastAligned) result += *vector++; @@ -377,7 +377,7 @@ float meanSquaredSSE(const float* vector, unsigned size) noexcept if (size == 0) return result; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(vector) && vector < lastAligned) { result += (*vector) * (*vector); @@ -414,7 +414,7 @@ void cumsumSSE(const float* input, float* output, unsigned size) noexcept const auto sentinel = output + size; *output++ = *input++; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) { *output = *(output - 1) + *input; @@ -447,7 +447,7 @@ void diffSSE(const float* input, float* output, unsigned size) noexcept const auto sentinel = output + size; *output++ = *input++; -#ifdef SFIZZ_HAVE_SSE +#if SFIZZ_HAVE_SSE2 const auto* lastAligned = prevAligned(sentinel); while (unaligned(input, output) && output < lastAligned) { *output = *input - *(input - 1);