Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-02-14 16:20:51 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-02-17 18:26:24 +0300
commit859118d8f6ff022a16acbc6435488883424bad25 (patch)
treee0f708929a884070f7c3758f7fb58527cbdfd555 /source/blender/blenlib/intern
parentac680c569e1b979f20c2e81dbd4f232085141aad (diff)
BLI: add BLI_simd.h header to wrap SSE includes
In preparation of adding Neon support. Ref D8237, T78710
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c11
-rw-r--r--source/blender/blenlib/intern/math_color_inline.c6
-rw-r--r--source/blender/blenlib/intern/math_geom.c2
-rw-r--r--source/blender/blenlib/intern/math_matrix.c2
4 files changed, 9 insertions, 12 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 28aa81e5858..39945960e68 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -31,11 +31,8 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef __SSE2__
-# include <emmintrin.h>
-#endif
-
#include "BLI_math_base.h"
+#include "BLI_simd.h"
#ifdef __cplusplus
extern "C" {
@@ -685,10 +682,10 @@ MINLINE int integer_digits_i(const int i)
/* Internal helpers for SSE2 implementation.
*
- * NOTE: Are to be called ONLY from inside `#ifdef __SSE2__` !!!
+ * NOTE: Are to be called ONLY from inside `#ifdef BLI_HAVE_SSE2` !!!
*/
-#ifdef __SSE2__
+#ifdef BLI_HAVE_SSE2
/* Calculate initial guess for arg^exp based on float representation
* This method gives a constant bias, which can be easily compensated by
@@ -769,7 +766,7 @@ MALWAYS_INLINE __m128 _bli_math_blend_sse(const __m128 mask, const __m128 a, con
return _mm_or_ps(_mm_and_ps(mask, a), _mm_andnot_ps(mask, b));
}
-#endif /* __SSE2__ */
+#endif /* BLI_HAVE_SSE2 */
/* Low level conversion functions */
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index 26828cb8717..4c50c1c7af8 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -34,7 +34,7 @@
/******************************** Color Space ********************************/
-# ifdef __SSE2__
+# ifdef BLI_HAVE_SSE2
MALWAYS_INLINE __m128 srgb_to_linearrgb_v4_simd(const __m128 c)
{
@@ -75,7 +75,7 @@ MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
srgb[2] = r[2];
}
-# else /* __SSE2__ */
+# else /* BLI_HAVE_SSE2 */
MINLINE void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
{
@@ -90,7 +90,7 @@ MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
srgb[1] = linearrgb_to_srgb(linear[1]);
srgb[2] = linearrgb_to_srgb(linear[2]);
}
-# endif /* __SSE2__ */
+# endif /* BLI_HAVE_SSE2 */
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
{
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 5d78bb0b901..b7e94e6c512 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -5907,7 +5907,7 @@ static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float
#if 0
-# include <xmmintrin.h>
+# include "BLI_simd.h"
static __m128 sse_approx_acos(__m128 x)
{
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 6b5efc3f8c4..b460d75d77f 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -277,7 +277,7 @@ void mul_m4_m4m4_uniq(float R[4][4], const float A[4][4], const float B[4][4])
BLI_assert(!ELEM(R, A, B));
/* matrix product: R[j][k] = A[j][i] . B[i][k] */
-#ifdef __SSE2__
+#ifdef BLI_HAVE_SSE2
__m128 A0 = _mm_loadu_ps(A[0]);
__m128 A1 = _mm_loadu_ps(A[1]);
__m128 A2 = _mm_loadu_ps(A[2]);