[bug] Problem with SIMDregister masking (juce 5.4.3 xcode 10.1 macos 10.14.4)

Hi everyone,
I get a strange error, but I’m new in SIMD, so it might be something obvious…

The following limiter code compiles correctly:
auto mask = dsp::SIMDRegister< float >::greaterThan(accu,halfVector);
accu = ( halfVector & mask) + ( accu & (~mask));

But the linker quits with an error:
Undefined symbols for architecture x86_64:

EDIT: I must add that sofar the rest of my SIMD code works fine (and fast): it is only this mask creation that creates a link error on kAllBitsSet

Which SIMD implementation is being used? Are any of juce_dsp/native/juce_avx_SIMDNativeOps.h, juce_dsp/native/juce_sse_SIMDNativeOps.h, or juce_dsp/native/juce_neon_SIMDNativeOps.h being included?

1 Like

juce_dsp/native/juce_sse_SIMDNativeOps.h is included by Juce.

a bit more info: The error is caused by the ~ operator.

“juce::dsp::SIMDNativeOps::kAllBitsSet”, referenced from:
juce::dsp::SIMDRegister::operator~() const in lto.o
ld: symbol(s) not found for architecture x86_64

In SIMS Register.h the ~ is declared like this:

inline SIMDRegister JUCE_VECTOR_CALLTYPE operator ~() const noexcept { return { NativeOps::bit_not (value) }; }

this references the SSE function in juce_sse_SIMDNativeOps.h), where kAllBitsSet is referenced:

static forcedinline __m128 JUCE_VECTOR_CALLTYPE bit_not (__m128 a) noexcept { return bit_notand (a, _mm_loadu_ps ((float*) kAllBitsSet)); }

kAllBitsSet is however declared on the same page like this:

DECLARE_SSE_SIMD_CONST (int32_t, kAllBitsSet);

So I can not see the reason why kAllBitsSet isn’t defined…

Yeah it all looks correct to me. It could be due to some mis-match of modules on your system, are you able to reproduce it with a fresh project?

the thing is setup on 5.x , but I’ll doublecheck with a clean new project

here a fake function to load and test in juce standard pluginprocessor.

The weird thing: in release mode this works, in debug it brings nearly the same kAllBitsSet not defined error…

  dsp::SIMDRegister< float > vec1,vec2;
 // advance period..
     for (int channel = 0; channel < totalNumInputChannels; ++channel)
         float* channelData = buffer.getWritePointer (channel);
         auto mask = (dsp::SIMDRegister< float >::greaterThan(vec1,vec2)) ;
         vec2 = ( vec1 & mask) + ( vec2 & (~mask));
         channelData[0] = vec2[0]; // 

I’ve put that code inside of a new plug-in project generated by the Projucer and I’m still not seeing any link errors for kAllBitsSet. I’m on macOS 10.14.4 and Xcode 10.2 and the sse_SIMDNativeOps files are being compiled so I can’t see what could be causing the error.

you tried a debug build?

Yes, debug and release.

then my settings are somehow compromised… I’ll try make a fresh juce file and re-attach all the stuff. Tnx for the support Ed!