[Pixman] [PATCH 09/11] mmx: optimize in_8_8

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


Loongson:
in_8_8 =  L1:  97.57  L2:  96.29  M: 59.89 ( 41.50%)  HT: 48.32  VT: 52.45  R: 52.03  RT: 19.02 ( 168Kops/s)
in_8_8 =  L1:  96.51  L2:  97.07  M: 59.73 ( 41.81%)  HT: 48.47  VT: 52.80  R: 52.67  RT: 19.33 ( 177Kops/s)

ARM/iwMMXt:
in_8_8 =  L1: 105.12  L2:  82.73  M: 59.43 ( 35.38%)  HT: 37.88  VT: 41.18  R: 36.14  RT: 15.52 ( 124Kops/s)
in_8_8 =  L1:  74.93  L2:  63.00  M: 46.19 ( 27.49%)  HT: 33.81  VT: 48.70  R: 44.17  RT: 24.56 ( 152Kops/s)

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

diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index e697c13..21ba076 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -2693,13 +2693,13 @@ mmx_composite_in_8_8 (pixman_implementation_t *imp,
 
 	while (w && (unsigned long)dst & 3)
 	{
-	    uint8_t s, d;
 	    uint16_t tmp;
+	    uint8_t s = *src;
 
-	    s = *src;
-	    d = *dst;
-
-	    *dst = MUL_UN8 (s, d, tmp);
+	    if (s == 0)
+		*dst = 0;
+	    else if (s != 0xff)
+		*dst = MUL_UN8 (s, *dst, tmp);
 
 	    src++;
 	    dst++;
@@ -2708,10 +2708,12 @@ mmx_composite_in_8_8 (pixman_implementation_t *imp,
 
 	while (w >= 4)
 	{
-	    uint32_t *s = (uint32_t *)src;
-	    uint32_t *d = (uint32_t *)dst;
+	    __m64 vsrc = load8888u ((uint32_t *)src);
 
-	    store8888 (d, in (load8888u (s), load8888 (d)));
+	    if (is_zero (vsrc))
+		*(uint32_t *)dst = 0;
+	    else
+		store8888 ((uint32_t *)dst, in (vsrc, load8888 ((uint32_t *)dst)));
 
 	    w -= 4;
 	    dst += 4;
@@ -2720,13 +2722,13 @@ mmx_composite_in_8_8 (pixman_implementation_t *imp,
 
 	while (w--)
 	{
-	    uint8_t s, d;
 	    uint16_t tmp;
+	    uint8_t s = *src;
 
-	    s = *src;
-	    d = *dst;
-
-	    *dst = MUL_UN8 (s, d, tmp);
+	    if (s == 0)
+		*dst = 0;
+	    else if (s != 0xff)
+		*dst = MUL_UN8 (s, *dst, tmp);
 
 	    src++;
 	    dst++;
-- 
1.7.3.4



More information about the Pixman mailing list