Brainfart on the ifdef
This commit is contained in:
parent
6e241fe93a
commit
50d5c3a80e
2 changed files with 24 additions and 24 deletions
|
|
@ -9,8 +9,8 @@
|
||||||
#include "../MathHelpers.h"
|
#include "../MathHelpers.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_AVX
|
#if SFIZZ_HAVE_AVX
|
||||||
#include "immintrin.h"
|
#include <immintrin.h>
|
||||||
using Type = float;
|
using Type = float;
|
||||||
constexpr unsigned TypeAlignment = 8;
|
constexpr unsigned TypeAlignment = 8;
|
||||||
constexpr unsigned ByteAlignment = TypeAlignment * sizeof(Type);
|
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;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_AVX
|
#if SFIZZ_HAVE_AVX
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
const auto mmGain = _mm256_set1_ps(gain);
|
const auto mmGain = _mm256_set1_ps(gain);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
|
|
@ -40,7 +40,7 @@ void applyGainAVX(const float* gain, const float* input, float* output, unsigned
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_AVX
|
#if SFIZZ_HAVE_AVX
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
*output++ = (*gain++) * (*input++);
|
*output++ = (*gain++) * (*input++);
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
||||||
|
|
||||||
#include "HelpersSSE.h"
|
#include "HelpersSSE.h"
|
||||||
#include "../MathHelpers.h"
|
|
||||||
#include "../SIMDConfig.h"
|
#include "../SIMDConfig.h"
|
||||||
|
#include "../MathHelpers.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
#include "emmintrin.h"
|
#include <emmintrin.h>
|
||||||
using Type = float;
|
using Type = float;
|
||||||
constexpr unsigned TypeAlignment = 4;
|
constexpr unsigned TypeAlignment = 4;
|
||||||
constexpr unsigned ByteAlignment = TypeAlignment * sizeof(Type);
|
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;
|
const auto sentinel = input + inputSize - 1;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(input + inputSize - TypeAlignment);
|
const auto* lastAligned = prevAligned<ByteAlignment>(input + inputSize - TypeAlignment);
|
||||||
while (unaligned<ByteAlignment>(input, outputLeft, outputRight) && input < lastAligned) {
|
while (unaligned<ByteAlignment>(input, outputLeft, outputRight) && input < lastAligned) {
|
||||||
*outputLeft++ = *input++;
|
*outputLeft++ = *input++;
|
||||||
|
|
@ -58,7 +58,7 @@ void writeInterleavedSSE(const float* inputLeft, const float* inputRight, float*
|
||||||
{
|
{
|
||||||
const auto sentinel = output + outputSize - 1;
|
const auto sentinel = output + outputSize - 1;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(output + outputSize - TypeAlignment);
|
const auto* lastAligned = prevAligned<ByteAlignment>(output + outputSize - TypeAlignment);
|
||||||
while (unaligned<ByteAlignment>(output, inputRight, inputLeft) && output < lastAligned) {
|
while (unaligned<ByteAlignment>(output, inputRight, inputLeft) && output < lastAligned) {
|
||||||
*output++ = *inputLeft++;
|
*output++ = *inputLeft++;
|
||||||
|
|
@ -86,7 +86,7 @@ void applyGainSSE(float gain, const float* input, float* output, unsigned size)
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
const auto mmGain = _mm_set1_ps(gain);
|
const auto mmGain = _mm_set1_ps(gain);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
|
|
@ -106,7 +106,7 @@ void applyGainSSE(const float* gain, const float* input, float* output, unsigned
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
*output++ = (*gain++) * (*input++);
|
*output++ = (*gain++) * (*input++);
|
||||||
|
|
@ -143,7 +143,7 @@ void multiplyAddSSE(const float* gain, const float* input, float* output, unsign
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
*output++ += (*gain++) * (*input++);
|
*output++ += (*gain++) * (*input++);
|
||||||
|
|
@ -164,7 +164,7 @@ void multiplyAddSSE(float gain, const float* input, float* output, unsigned size
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
*output++ += gain * (*input++);
|
*output++ += gain * (*input++);
|
||||||
|
|
@ -186,7 +186,7 @@ float linearRampSSE(float* output, float start, float step, unsigned size) noexc
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(output) && output < lastAligned) {
|
while (unaligned<ByteAlignment>(output) && output < lastAligned) {
|
||||||
*output++ = start;
|
*output++ = start;
|
||||||
|
|
@ -215,7 +215,7 @@ float multiplicativeRampSSE(float* output, float start, float step, unsigned siz
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(output) && output < lastAligned) {
|
while (unaligned<ByteAlignment>(output) && output < lastAligned) {
|
||||||
*output++ = start;
|
*output++ = start;
|
||||||
|
|
@ -244,7 +244,7 @@ void addSSE(const float* input, float* output, unsigned size) noexcept
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
*output++ += *input++;
|
*output++ += *input++;
|
||||||
|
|
@ -263,7 +263,7 @@ void addSSE(float value, float* output, unsigned size) noexcept
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(output) && output < lastAligned)
|
||||||
*output++ += value;
|
*output++ += value;
|
||||||
|
|
@ -283,7 +283,7 @@ void subtractSSE(const float* input, float* output, unsigned size) noexcept
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned)
|
||||||
*output++ -= *input++;
|
*output++ -= *input++;
|
||||||
|
|
@ -302,7 +302,7 @@ void subtractSSE(float value, float* output, unsigned size) noexcept
|
||||||
{
|
{
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(output) && output < lastAligned)
|
while (unaligned<ByteAlignment>(output) && output < lastAligned)
|
||||||
*output++ -= value;
|
*output++ -= value;
|
||||||
|
|
@ -323,7 +323,7 @@ void copySSE(const float* input, float* output, unsigned size) noexcept
|
||||||
// The sentinel is the input here
|
// The sentinel is the input here
|
||||||
const auto sentinel = input + size;
|
const auto sentinel = input + size;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && input < lastAligned)
|
while (unaligned<ByteAlignment>(input, output) && input < lastAligned)
|
||||||
*output++ = *input++;
|
*output++ = *input++;
|
||||||
|
|
@ -345,7 +345,7 @@ float meanSSE(const float* vector, unsigned size) noexcept
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(vector) && vector < lastAligned)
|
while (unaligned<ByteAlignment>(vector) && vector < lastAligned)
|
||||||
result += *vector++;
|
result += *vector++;
|
||||||
|
|
@ -377,7 +377,7 @@ float meanSquaredSSE(const float* vector, unsigned size) noexcept
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(vector) && vector < lastAligned) {
|
while (unaligned<ByteAlignment>(vector) && vector < lastAligned) {
|
||||||
result += (*vector) * (*vector);
|
result += (*vector) * (*vector);
|
||||||
|
|
@ -414,7 +414,7 @@ void cumsumSSE(const float* input, float* output, unsigned size) noexcept
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
*output++ = *input++;
|
*output++ = *input++;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned) {
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned) {
|
||||||
*output = *(output - 1) + *input;
|
*output = *(output - 1) + *input;
|
||||||
|
|
@ -447,7 +447,7 @@ void diffSSE(const float* input, float* output, unsigned size) noexcept
|
||||||
const auto sentinel = output + size;
|
const auto sentinel = output + size;
|
||||||
*output++ = *input++;
|
*output++ = *input++;
|
||||||
|
|
||||||
#ifdef SFIZZ_HAVE_SSE
|
#if SFIZZ_HAVE_SSE2
|
||||||
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
const auto* lastAligned = prevAligned<ByteAlignment>(sentinel);
|
||||||
while (unaligned<ByteAlignment>(input, output) && output < lastAligned) {
|
while (unaligned<ByteAlignment>(input, output) && output < lastAligned) {
|
||||||
*output = *input - *(input - 1);
|
*output = *input - *(input - 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue