From 6f67371bb1b46579ae837d0e0c61ac1b291be743 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 13 Jan 2018 07:51:33 +0500 Subject: Directory renamed --- external/include/glm/detail/func_common_simd.inl | 231 +++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 external/include/glm/detail/func_common_simd.inl (limited to 'external/include/glm/detail/func_common_simd.inl') diff --git a/external/include/glm/detail/func_common_simd.inl b/external/include/glm/detail/func_common_simd.inl new file mode 100644 index 0000000..c76f180 --- /dev/null +++ b/external/include/glm/detail/func_common_simd.inl @@ -0,0 +1,231 @@ +/// @ref core +/// @file glm/detail/func_common_simd.inl + +#if GLM_ARCH & GLM_ARCH_SSE2_BIT + +#include "../simd/common.h" + +#include + +namespace glm{ +namespace detail +{ + template + struct compute_abs_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) + { + tvec4 result(uninitialize); + result.data = glm_vec4_abs(v.data); + return result; + } + }; + + template + struct compute_abs_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) + { + tvec4 result(uninitialize); + result.data = glm_ivec4_abs(v.data); + return result; + } + }; + + template + struct compute_floor + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) + { + tvec4 result(uninitialize); + result.data = glm_vec4_floor(v.data); + return result; + } + }; + + template + struct compute_ceil + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) + { + tvec4 result(uninitialize); + result.data = glm_vec4_ceil(v.data); + return result; + } + }; + + template + struct compute_fract + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) + { + tvec4 result(uninitialize); + result.data = glm_vec4_fract(v.data); + return result; + } + }; + + template + struct compute_round + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v) + { + tvec4 result(uninitialize); + result.data = glm_vec4_round(v.data); + return result; + } + }; + + template + struct compute_mod + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & x, tvec4 const & y) + { + tvec4 result(uninitialize); + result.data = glm_vec4_mod(x.data, y.data); + return result; + } + }; + + template + struct compute_min_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v1, tvec4 const & v2) + { + tvec4 result(uninitialize); + result.data = _mm_min_ps(v1.data, v2.data); + return result; + } + }; + + template + struct compute_min_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v1, tvec4 const & v2) + { + tvec4 result(uninitialize); + result.data = _mm_min_epi32(v1.data, v2.data); + return result; + } + }; + + template + struct compute_min_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v1, tvec4 const & v2) + { + tvec4 result(uninitialize); + result.data = _mm_min_epu32(v1.data, v2.data); + return result; + } + }; + + template + struct compute_max_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v1, tvec4 const & v2) + { + tvec4 result(uninitialize); + result.data = _mm_max_ps(v1.data, v2.data); + return result; + } + }; + + template + struct compute_max_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v1, tvec4 const & v2) + { + tvec4 result(uninitialize); + result.data = _mm_max_epi32(v1.data, v2.data); + return result; + } + }; + + template + struct compute_max_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & v1, tvec4 const & v2) + { + tvec4 result(uninitialize); + result.data = _mm_max_epu32(v1.data, v2.data); + return result; + } + }; + + template + struct compute_clamp_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & x, tvec4 const & minVal, tvec4 const & maxVal) + { + tvec4 result(uninitialize); + result.data = _mm_min_ps(_mm_max_ps(x.data, minVal.data), maxVal.data); + return result; + } + }; + + template + struct compute_clamp_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & x, tvec4 const & minVal, tvec4 const & maxVal) + { + tvec4 result(uninitialize); + result.data = _mm_min_epi32(_mm_max_epi32(x.data, minVal.data), maxVal.data); + return result; + } + }; + + template + struct compute_clamp_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & x, tvec4 const & minVal, tvec4 const & maxVal) + { + tvec4 result(uninitialize); + result.data = _mm_min_epu32(_mm_max_epu32(x.data, minVal.data), maxVal.data); + return result; + } + }; + + template + struct compute_mix_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & x, tvec4 const & y, tvec4 const & a) + { + __m128i const Load = _mm_set_epi32(-(int)a.w, -(int)a.z, -(int)a.y, -(int)a.x); + __m128 const Mask = _mm_castsi128_ps(Load); + + tvec4 Result(uninitialize); +# if 0 && GLM_ARCH & GLM_ARCH_AVX + Result.data = _mm_blendv_ps(x.data, y.data, Mask); +# else + Result.data = _mm_or_ps(_mm_and_ps(Mask, y.data), _mm_andnot_ps(Mask, x.data)); +# endif + return Result; + } + }; +/* FIXME + template + struct compute_step_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& edge, tvec4 const& x) + { + tvec4 result(uninitialize); + result.data = glm_vec4_step(edge.data, x.data); + return result; + } + }; +*/ + template + struct compute_smoothstep_vector + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const& edge0, tvec4 const& edge1, tvec4 const& x) + { + tvec4 result(uninitialize); + result.data = glm_vec4_smoothstep(edge0.data, edge1.data, x.data); + return result; + } + }; +}//namespace detail +}//namespace glm + +#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT -- cgit v1.2.3