[Pixman] [PATCH 2/2] mmx: Use Loongson pextrh instruction in expand565
Matt Turner
mattst88 at gmail.com
Tue Apr 17 09:27:45 PDT 2012
Same story as pinsrh in the previous commit.
text data bss dec hex filename
25336 1952 0 27288 6a98 .libs/libpixman_loongson_mmi_la-pixman-mmx.o
25072 1952 0 27024 6990 .libs/libpixman_loongson_mmi_la-pixman-mmx.o
-dsll: 95
+dsll: 70
-dsrl: 135
+dsrl: 105
-ldc1: 462
+ldc1: 445
-lw: 721
+lw: 700
+pextrh: 30
---
pixman/loongson-mmintrin.h | 11 +++++++++++
pixman/pixman-mmx.c | 4 ++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/pixman/loongson-mmintrin.h b/pixman/loongson-mmintrin.h
index a67e45a..333c65e 100644
--- a/pixman/loongson-mmintrin.h
+++ b/pixman/loongson-mmintrin.h
@@ -218,6 +218,17 @@ _mm_xor_si64 (__m64 __m1, __m64 __m2)
}
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+loongson_extract_pi16 (__m64 __m, int64_t __pos)
+{
+ __m64 ret;
+ asm("pextrh %0, %1, %2\n\t"
+ : "=f" (ret)
+ : "f" (__m), "f" (*(__m64 *)&__pos)
+ );
+ return ret;
+}
+
+extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
loongson_insert_pi16 (__m64 __m1, __m64 __m2, int __pos)
{
__m64 ret;
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index a547e23..cc2121e 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -488,7 +488,11 @@ expand565 (__m64 pixel, int pos)
__m64 t1, t2;
/* move pixel to low 16 bit and zero the rest */
+#ifdef USE_LOONGSON_MMI
+ p = loongson_extract_pi16 (p, pos);
+#else
p = shift (shift (p, (3 - pos) * 16), -48);
+#endif
t1 = shift (p, 36 - 11);
t2 = shift (p, 16 - 5);
--
1.7.8.5
More information about the Pixman
mailing list