Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict 7081 #50

Merged
merged 2 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/sst/basic-blocks/dsp/BlockInterpolators.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,28 @@ template <int maxBlockSize, bool first_run_checks = true> struct alignas(16) lip
fade_block_to(src21, src22, dst2, bsQuad);
}

void fade_blocks_inplace(float *__restrict inAOut, float *__restrict inB) const
{
for (int i = 0; i < numRegisters; ++i)
{
auto a = _mm_load_ps(inAOut + (i << 2));
auto b = _mm_load_ps(inB + (i << 2));
auto sa = _mm_mul_ps(a, _mm_sub_ps(one, line[i]));
auto sb = _mm_mul_ps(b, line[i]);
auto r = _mm_add_ps(sa, sb);
_mm_store_ps(inAOut + (i << 2), r);
}
}

void fade_2_blocks_inplace(float *__restrict src11out, float *__restrict src12,
float *__restrict src21out, float *__restrict src22,
int bsQuad = -1) const
{
assert(bsQuad == -1 || bsQuad == numRegisters);
fade_blocks_inplace(src11out, src12);
fade_blocks_inplace(src21out, src22);
}

void store_block(float *__restrict out, int bsQuad = -1) const
{
assert(bsQuad == -1 || bsQuad == numRegisters);
Expand Down
26 changes: 26 additions & 0 deletions include/sst/basic-blocks/mechanics/block-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ inline void add_block(const float *__restrict src1, const float *__restrict src2
}
}

template <size_t blocksize>
inline void add_block(float *__restrict srcdst, const float *__restrict src2)
{
for (auto i = 0U; i < blocksize; ++i)
{
srcdst[i] = srcdst[i] + src2[i];
}
}

template <size_t blockSize>
inline void mul_block(float *__restrict src1, float *src2, float *__restrict dst)
{
Expand All @@ -96,6 +105,23 @@ inline void mul_block(float *__restrict src1, float scalar, float *__restrict ds
dst[i] = src1[i] * scalar;
}
}

template <size_t blockSize> inline void mul_block(float *__restrict srcDst, float *__restrict by)
{
for (auto i = 0U; i < blockSize; ++i)
{
srcDst[i] = srcDst[i] * by[i];
}
}

template <size_t blockSize> inline void mul_block(float *__restrict srcDst, float by)
{
for (auto i = 0U; i < blockSize; ++i)
{
srcDst[i] = srcDst[i] * by;
}
}

template <size_t blockSize>
inline void scale_by(const float *__restrict scale, float *__restrict target)
{
Expand Down