From: Matt Turner Date: Tue, 17 Apr 2012 16:16:55 +0000 (-0400) Subject: mmx: Use Loongson pextrh instruction in expand565 X-Git-Tag: pixman-0.25.6~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c136e535adf33069cbf229b8773934d78099af85;p=platform%2Fupstream%2Fpixman.git 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 --- diff --git a/pixman/loongson-mmintrin.h b/pixman/loongson-mmintrin.h index 1c74ed8..508366c 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 7aa4019..d5d34ac 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);