[Pixman] [PATCH 02/11] mmx: add load function and use it in add_8888_8888

Matt Turner mattst88 at gmail.com
Wed Mar 14 21:00:40 PDT 2012


Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 pixman/pixman-mmx.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 7acec6f..137a214 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -349,9 +349,15 @@ static __inline__ uint32_t ldl_u(const uint32_t *p)
 }
 
 static force_inline __m64
+load (const uint32_t *v)
+{
+    return _mm_cvtsi32_si64 (*v);
+}
+
+static force_inline __m64
 load8888 (const uint32_t *v)
 {
-    return _mm_unpacklo_pi8 (_mm_cvtsi32_si64 (*v), _mm_setzero_si64 ());
+    return _mm_unpacklo_pi8 (load (v), _mm_setzero_si64 ());
 }
 
 static force_inline __m64
@@ -2857,8 +2863,8 @@ mmx_composite_add_8888_8888 (pixman_implementation_t *imp,
 
 	while (w && (unsigned long)dst & 7)
 	{
-	    store (dst, _mm_adds_pu8 (_mm_cvtsi32_si64 (*src),
-	                              _mm_cvtsi32_si64 (*dst)));
+	    store (dst, _mm_adds_pu8 (load ((const uint32_t *)src),
+	                              load ((const uint32_t *)dst)));
 	    dst++;
 	    src++;
 	    w--;
@@ -2875,8 +2881,8 @@ mmx_composite_add_8888_8888 (pixman_implementation_t *imp,
 
 	if (w)
 	{
-	    store (dst, _mm_adds_pu8 (_mm_cvtsi32_si64 (*src),
-	                              _mm_cvtsi32_si64 (*dst)));
+	    store (dst, _mm_adds_pu8 (load ((const uint32_t *)src),
+	                              load ((const uint32_t *)dst)));
 
 	}
     }
-- 
1.7.3.4



More information about the Pixman mailing list