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

Fix SIMDUtils::isnan compatibility between SSE and ARM NEON #99

Merged
merged 4 commits into from
Dec 19, 2021
Merged
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
7 changes: 7 additions & 0 deletions modules/chowdsp_dsp/SIMD/chowdsp_SIMDUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,15 @@ Based on: https://forum.juce.com/t/divide-by-simdregister/28968/18
template <typename T>
inline typename juce::dsp::SIMDRegister<T>::vMaskType isnanSIMD (juce::dsp::SIMDRegister<T> x)
{
// For some reason, xsimd::isnan returns a batch of doubles when using SSE
// but returns a batch of unsigned ints when using ARM NEON.
#if JUCE_ARM
using MaskVec = typename juce::dsp::SIMDRegister<T>::vMaskType;
return (MaskVec) xsimd::isnan ((x_type<T>) x.value);
#else
using Vec = juce::dsp::SIMDRegister<T>;
return Vec::notEqual ((Vec) xsimd::isnan ((x_type<T>) x.value), (Vec) 0);
#endif
}

// Template specializations for NEON double precision
Expand Down