summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2012-04-17 12:16:55 -0400
committerMatt Turner <mattst88@gmail.com>2012-04-27 13:42:07 -0400
commitc136e535adf33069cbf229b8773934d78099af85 (patch)
tree5905446c33570a8cecab8c828a5461c6cc71000c
parentfacceb4a1fbba476ad98e76d15868bf7eecd3a30 (diff)
mmx: Use Loongson pextrh instruction in expand565
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
-rw-r--r--pixman/loongson-mmintrin.h11
-rw-r--r--pixman/pixman-mmx.c4
2 files changed, 15 insertions, 0 deletions
diff --git a/pixman/loongson-mmintrin.h b/pixman/loongson-mmintrin.h
index 1c74ed8a..508366c4 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, int64_t __pos)
{
__m64 ret;
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 7aa40195..d5d34ac0 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -493,7 +493,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);