From 130fffc0cdbfdc29f33f1ee97c09e744c19e243a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Wed, 10 Aug 2005 20:22:57 +0000 Subject: [PATCH] =?UTF-8?q?Wed=20Aug=2010=2016:17:38=202005=20S=C3=B8ren?= =?UTF-8?q?=20Sandmann=20=20Add=20back=20non-SSE=20im?= =?UTF-8?q?plementations.=20Define=20USE=5FSSE=20if=20the=20CPU=20is=20amd?= =?UTF-8?q?64/x86-64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fb/fbmmx.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/fb/fbmmx.c b/fb/fbmmx.c index fd1284496..ba649393f 100644 --- a/fb/fbmmx.c +++ b/fb/fbmmx.c @@ -36,6 +36,10 @@ #ifdef USE_MMX +#if defined(__amd64__) || defined(__x86_64__) +#define USE_SSE +#endif + #include #include /* for _mm_shuffle_pi16 and _MM_SHUFFLE */ @@ -155,6 +159,8 @@ pix_add (__m64 a, __m64 b) return _mm_adds_pu8 (a, b); } +#ifdef USE_SSE + static __inline__ __m64 expand_alpha (__m64 pixel) { @@ -173,6 +179,61 @@ invert_colors (__m64 pixel) return _mm_shuffle_pi16 (pixel, _MM_SHUFFLE(3, 0, 1, 2)); } +#else + +static __inline__ __m64 +expand_alpha (__m64 pixel) +{ + __m64 t1, t2; + + t1 = shift (pixel, -48); + t2 = shift (t1, 16); + t1 = _mm_or_si64 (t1, t2); + t2 = shift (t1, 32); + t1 = _mm_or_si64 (t1, t2); + + return t1; +} + +static __inline__ __m64 +expand_alpha_rev (__m64 pixel) +{ + __m64 t1, t2; + + /* move alpha to low 16 bits and zero the rest */ + t1 = shift (pixel, 48); + t1 = shift (t1, -48); + + t2 = shift (t1, 16); + t1 = _mm_or_si64 (t1, t2); + t2 = shift (t1, 32); + t1 = _mm_or_si64 (t1, t2); + + return t1; +} + +static __inline__ __m64 +invert_colors (__m64 pixel) +{ + __m64 x, y, z; + + x = y = z = pixel; + + x = _mm_and_si64 (x, MC(ffff0000ffff0000)); + y = _mm_and_si64 (y, MC(000000000000ffff)); + z = _mm_and_si64 (z, MC(0000ffff00000000)); + + y = shift (y, 32); + z = shift (z, -32); + + x = _mm_or_si64 (x, y); + x = _mm_or_si64 (x, z); + + return x; +} + +#endif + static __inline__ __m64 over (__m64 src, __m64 srca, __m64 dest) {