[openal] [PATCH] Add AVX linear resampler

Chris Robinson chris.kcat at gmail.com
Sun Jun 8 00:36:01 EDT 2014

On 06/07/2014 02:59 AM, Timothy Arceri wrote:
> +    float const fracOne = 1.0f/FRACTIONONE;
> +    ...
> +    const __m256 fracOne8 = _mm256_broadcast_ss(&fracOne);

I'm a bit confused by this. According to Intel's docs for 
_mm256_broadcast_ss and _mm_broadcast_ss:


the given parameter is a "pointer to a memory location that can hold 
constant 256-bit or 128-bit float32 values". In that case, isn't a raw 
float too small? It may also not be aligned correctly. Though if it's 
only taking a single float value, I don't see why it would have to be 
256/128 bits large. Maybe its in error in their docs.

Perhaps it would be better to do:

const __m256 fracOne8 = _mm256_set1_ps(1.0f/FRACTIONONE);

GCC should actually turn that call into a compile-time vector constant 
and simply move it into a register as needed (it does for _mm_set1_ps 
and _mm_set1_epi32 when given a compile-time constant).

More information about the openal mailing list