diff options
Diffstat (limited to 'intern/cycles/util/util_simd.h')
-rw-r--r-- | intern/cycles/util/util_simd.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h index f49cfb4184d..de0e3c39f30 100644 --- a/intern/cycles/util/util_simd.h +++ b/intern/cycles/util/util_simd.h @@ -75,6 +75,28 @@ static struct FalseTy { } } False ccl_maybe_unused; +static struct ZeroTy { + __forceinline operator float() const + { + return 0; + } + __forceinline operator int() const + { + return 0; + } +} zero ccl_maybe_unused; + +static struct OneTy { + __forceinline operator float() const + { + return 1; + } + __forceinline operator int() const + { + return 1; + } +} one ccl_maybe_unused; + static struct NegInfTy { __forceinline operator float() const { @@ -97,6 +119,9 @@ static struct PosInfTy { } } inf ccl_maybe_unused, pos_inf ccl_maybe_unused; +static struct StepTy { +} step ccl_maybe_unused; + /* Intrinsics Functions */ # if defined(__BMI__) && defined(__GNUC__) @@ -563,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 just as efficient. */ +# if defined(__KERNEL_AVX__) || defined(__KERNEL_AVX2__) +# 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 |