From 868d4526a8818fbffc5ea993fbbbd3890046a6e9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Apr 2020 17:25:48 +0200 Subject: Fix more build errors/warnings after recent AVX changes Thanks to Sergey and Ray for the help identifying the problem. --- intern/cycles/util/util_avxf.h | 3 ++- intern/cycles/util/util_simd.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/intern/cycles/util/util_avxf.h b/intern/cycles/util/util_avxf.h index 47d416afbb7..1fb3ded422f 100644 --- a/intern/cycles/util/util_avxf.h +++ b/intern/cycles/util/util_avxf.h @@ -266,7 +266,8 @@ template __forceinline const avxf shuffle(const avxf &a) template __forceinline float extract(const avxf &a) { - return _mm256_cvtss_f32(shuffle(a).m256); + __m256 b = shuffle(a).m256; + return _mm256_cvtss_f32(b); } template<> __forceinline float extract<0>(const avxf &a) { diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h index 922f5dd274e..ac2893692df 100644 --- a/intern/cycles/util/util_simd.h +++ b/intern/cycles/util/util_simd.h @@ -588,6 +588,13 @@ __forceinline __m128 _mm_round_ps_emu(__m128 value, const int flags) # endif /* !(defined(__KERNEL_SSE41__) || defined(__SSE4_1__) || defined(__SSE4_2__)) */ +/* Older GCC versions do not have _mm256_cvtss_f32 yet, so define it ourselves. + * _mm256_castps256_ps128 generates no instructions so this is jus as efficient. */ +# ifdef __KERNEL_AVX__ +# undef _mm256_cvtss_f32 +# define _mm256_cvtss_f32(a) (_mm_cvtss_f32(_mm256_castps256_ps128(a))) +# endif + # else /* __KERNEL_SSE2__ */ /* This section is for utility functions which operates on non-register data -- cgit v1.2.3