[Pixman] [PATCH 1/3] mmx: use MMX inline assembly only when USE_MMX
mattst88 at gmail.com
mattst88 at gmail.com
Wed Jul 20 12:29:12 PDT 2011
From: Matt Turner <mattst88 at gmail.com>
Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
pixman/pixman-mmx.c | 88 ++------------------------------------------------
1 files changed, 4 insertions(+), 84 deletions(-)
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 697ec4c..71fa18e 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -1795,7 +1795,7 @@ pixman_fill_mmx (uint32_t *bits,
uint32_t byte_width;
uint8_t *byte_line;
-#ifdef __GNUC__
+#if defined __GNUC__ && defined USE_MMX
__m64 v1, v2, v3, v4, v5, v6, v7;
#endif
@@ -1829,7 +1829,7 @@ pixman_fill_mmx (uint32_t *bits,
fill = ((uint64_t)xor << 32) | xor;
vfill = to_m64 (fill);
-#ifdef __GNUC__
+#if defined __GNUC__ && defined USE_MMX
__asm__ (
"movq %7, %0\n"
"movq %7, %1\n"
@@ -1875,7 +1875,7 @@ pixman_fill_mmx (uint32_t *bits,
while (w >= 64)
{
-#ifdef __GNUC__
+#if defined __GNUC__ && defined USE_MMX
__asm__ (
"movq %1, (%0)\n"
"movq %2, 8(%0)\n"
@@ -2844,87 +2844,7 @@ pixman_blt_mmx (uint32_t *src_bits,
dst_bytes += dst_stride;
w = byte_width;
- while (w >= 2 && ((unsigned long)d & 3))
- {
- *(uint16_t *)d = *(uint16_t *)s;
- w -= 2;
- s += 2;
- d += 2;
- }
-
- while (w >= 4 && ((unsigned long)d & 7))
- {
- *(uint32_t *)d = *(uint32_t *)s;
-
- w -= 4;
- s += 4;
- d += 4;
- }
-
- while (w >= 64)
- {
-#if defined (__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
- __asm__ (
- "movq (%1), %%mm0\n"
- "movq 8(%1), %%mm1\n"
- "movq 16(%1), %%mm2\n"
- "movq 24(%1), %%mm3\n"
- "movq 32(%1), %%mm4\n"
- "movq 40(%1), %%mm5\n"
- "movq 48(%1), %%mm6\n"
- "movq 56(%1), %%mm7\n"
-
- "movq %%mm0, (%0)\n"
- "movq %%mm1, 8(%0)\n"
- "movq %%mm2, 16(%0)\n"
- "movq %%mm3, 24(%0)\n"
- "movq %%mm4, 32(%0)\n"
- "movq %%mm5, 40(%0)\n"
- "movq %%mm6, 48(%0)\n"
- "movq %%mm7, 56(%0)\n"
- :
- : "r" (d), "r" (s)
- : "memory",
- "%mm0", "%mm1", "%mm2", "%mm3",
- "%mm4", "%mm5", "%mm6", "%mm7");
-#else
- __m64 v0 = *(__m64 *)(s + 0);
- __m64 v1 = *(__m64 *)(s + 8);
- __m64 v2 = *(__m64 *)(s + 16);
- __m64 v3 = *(__m64 *)(s + 24);
- __m64 v4 = *(__m64 *)(s + 32);
- __m64 v5 = *(__m64 *)(s + 40);
- __m64 v6 = *(__m64 *)(s + 48);
- __m64 v7 = *(__m64 *)(s + 56);
- *(__m64 *)(d + 0) = v0;
- *(__m64 *)(d + 8) = v1;
- *(__m64 *)(d + 16) = v2;
- *(__m64 *)(d + 24) = v3;
- *(__m64 *)(d + 32) = v4;
- *(__m64 *)(d + 40) = v5;
- *(__m64 *)(d + 48) = v6;
- *(__m64 *)(d + 56) = v7;
-#endif
-
- w -= 64;
- s += 64;
- d += 64;
- }
- while (w >= 4)
- {
- *(uint32_t *)d = *(uint32_t *)s;
-
- w -= 4;
- s += 4;
- d += 4;
- }
- if (w >= 2)
- {
- *(uint16_t *)d = *(uint16_t *)s;
- w -= 2;
- s += 2;
- d += 2;
- }
+ memcpy(d, s, w);
}
_mm_empty ();
--
1.7.3.4
More information about the Pixman
mailing list