AVX align and also hasAvx()?


Guys, one favour to ask Jules: could you please, if possible, add hasAVX() just like we have hasSSE() now? ;-)

Another thing. My code is already windows and mac ready and uses SSE code with 16 bit align data. But, AVX to really work needs 32 bits align. So, I wonder, do I need to create two buils them? Or I should just use realtime declare variables (new align instead of just a fixed var) checking if it should be 16 or 32 bits aligned?

Thanks in advance!


Sure, a hasAVX function is on my to-do-list..

I don't really follow what you're asking about alignment though?


Thanks Jules. The Data Align I mean, right now, for SSE, I use:

JUCE_ALIGNED(16) float variable[128];

Now, for AVX I need to use JUCE_ALIGNED(32) instead. So, do I need to compile a specially-for-avx file separated from the other files, or is there another solution I don't know? I guess I could just use dynamic-allocated variables instead, this way I can check if I will use SSE or AVX and pick the right _align_malloc (16 or 32) call.


TBH if it was me then I'd just make them all 32-byte aligned. It'd probably make no discernable difference if a few bytes are wasted on an SSE machine.


I was wondering about that too, if I align as 32 bits, it would still be 16 bits aligned for SSE, right? Thanks bud! I will try that...


32 bits aligned are of course 16 bits aligned as well


Indeed, thanks guys. Just one thing I need to test is on the MAC side, as currently everything is 16 bits aligned, so I wonder if I will need to worry about 32 bits align on the MAC, as currently only memory variables I need to force 16 bit align for SSE support.