[Bf-blender-cvs] [868d4526a88] master: Fix more build errors/warnings after recent AVX changes
Brecht Van Lommel
noreply at git.blender.org
Thu Apr 2 17:31:06 CEST 2020
Commit: 868d4526a8818fbffc5ea993fbbbd3890046a6e9
Author: Brecht Van Lommel
Date: Thu Apr 2 17:25:48 2020 +0200
Branches: master
https://developer.blender.org/rB868d4526a8818fbffc5ea993fbbbd3890046a6e9
Fix more build errors/warnings after recent AVX changes
Thanks to Sergey and Ray for the help identifying the problem.
===================================================================
M intern/cycles/util/util_avxf.h
M intern/cycles/util/util_simd.h
===================================================================
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<size_t i0> __forceinline const avxf shuffle(const avxf &a)
template<size_t i> __forceinline float extract(const avxf &a)
{
- return _mm256_cvtss_f32(shuffle<i, i, i, i>(a).m256);
+ __m256 b = shuffle<i, i, i, i>(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
More information about the Bf-blender-cvs
mailing list