AVX gcc compatibility

`_mm256_cvtss_f32` is only available in avxintrin.h of gcc-8 or
later. There it is defined as

```
extern __inline float
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_cvtss_f32 (__m256 __A)
{
  return __A[0];
}
```

While explicit `vcurrent[0]` works with gcc-5 and gcc-6,
older gcc-4 fails with the following
 error: invalid types 'float __vector__[int]' for array subscript
This commit is contained in:
Robin Gareus 2020-08-11 16:02:07 +02:00
parent 01dbbb86c3
commit 68f1ec348d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -137,7 +137,13 @@ x86_sse_avx_compute_peak(const float *src, uint32_t nframes, float current)
// zero upper 128 bit of 256 bit ymm register to avoid penalties using non-AVX instructions
_mm256_zeroupper();
return vcurrent[0]; // _mm256_cvtss_f32
#if defined(__GNUC__) && (__GNUC__ < 5)
return *((float *)&vcurrent);
#elif defined(__GNUC__) && (__GNUC__ < 8)
return vcurrent[0];
#else
return _mm256_cvtss_f32 (vcurrent);
#endif
}
/**