Fixed bug 2241 - SSE intrinsic in fillrect MMX path norfanin The MMX path in SDL_fillrect.c uses the SSE intrinsic _mm_stream_pi. The function or symbol provided by the compiler will not be present because the SSE header may not get included. The linker will complain about an undefined reference. Since this is the only intrinsic used here (and someone forgot to create one for MOVQ), I think the MMX path can be removed completely. At least I don't see another way to move 64-bits from an MMX register to memory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c
index d891e4e..51f3314 100644
--- a/src/video/SDL_fillrect.c
+++ b/src/video/SDL_fillrect.c
@@ -132,105 +132,6 @@ DEFINE_SSE_FILLRECT(4, Uint32)
/* *INDENT-ON* */
#endif /* __SSE__ */
-#ifdef __MMX__
-/* *INDENT-OFF* */
-
-#define MMX_BEGIN \
- __m64 c64 = _mm_set_pi32(color, color)
-
-#define MMX_WORK \
- for (i = n / 64; i--;) { \
- _mm_stream_pi((__m64 *)(p+0), c64); \
- _mm_stream_pi((__m64 *)(p+8), c64); \
- _mm_stream_pi((__m64 *)(p+16), c64); \
- _mm_stream_pi((__m64 *)(p+24), c64); \
- _mm_stream_pi((__m64 *)(p+32), c64); \
- _mm_stream_pi((__m64 *)(p+40), c64); \
- _mm_stream_pi((__m64 *)(p+48), c64); \
- _mm_stream_pi((__m64 *)(p+56), c64); \
- p += 64; \
- }
-
-#define MMX_END \
- _mm_empty()
-
-#define DEFINE_MMX_FILLRECT(bpp, type) \
-static void \
-SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
-{ \
- int i, n; \
- Uint8 *p = NULL; \
- \
- MMX_BEGIN; \
- \
- while (h--) { \
- n = w * bpp; \
- p = pixels; \
- \
- if (n > 63) { \
- int adjust = 8 - ((uintptr_t)p & 7); \
- if (adjust < 8) { \
- n -= adjust; \
- adjust /= bpp; \
- while (adjust--) { \
- *((type *)p) = (type)color; \
- p += bpp; \
- } \
- } \
- MMX_WORK; \
- } \
- if (n & 63) { \
- int remainder = (n & 63); \
- remainder /= bpp; \
- while (remainder--) { \
- *((type *)p) = (type)color; \
- p += bpp; \
- } \
- } \
- pixels += pitch; \
- } \
- \
- MMX_END; \
-}
-
-static void
-SDL_FillRect1MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
-{
- int i, n;
- Uint8 *p = NULL;
-
- MMX_BEGIN;
-
- while (h--) {
- n = w;
- p = pixels;
-
- if (n > 63) {
- int adjust = 8 - ((uintptr_t)p & 7);
- if (adjust) {
- n -= adjust;
- SDL_memset(p, color, adjust);
- p += adjust;
- }
- MMX_WORK;
- }
- if (n & 63) {
- int remainder = (n & 63);
- SDL_memset(p, color, remainder);
- p += remainder;
- }
- pixels += pitch;
- }
-
- MMX_END;
-}
-/* DEFINE_MMX_FILLRECT(1, Uint8) */
-DEFINE_MMX_FILLRECT(2, Uint16)
-DEFINE_MMX_FILLRECT(4, Uint32)
-
-/* *INDENT-ON* */
-#endif /* __MMX__ */
-
static void
SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
{
@@ -373,12 +274,6 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
break;
}
#endif
-#ifdef __MMX__
- if (SDL_HasMMX()) {
- SDL_FillRect1MMX(pixels, dst->pitch, color, rect->w, rect->h);
- break;
- }
-#endif
SDL_FillRect1(pixels, dst->pitch, color, rect->w, rect->h);
break;
}
@@ -392,12 +287,6 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
break;
}
#endif
-#ifdef __MMX__
- if (SDL_HasMMX()) {
- SDL_FillRect2MMX(pixels, dst->pitch, color, rect->w, rect->h);
- break;
- }
-#endif
SDL_FillRect2(pixels, dst->pitch, color, rect->w, rect->h);
break;
}
@@ -417,12 +306,6 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
break;
}
#endif
-#ifdef __MMX__
- if (SDL_HasMMX()) {
- SDL_FillRect4MMX(pixels, dst->pitch, color, rect->w, rect->h);
- break;
- }
-#endif
SDL_FillRect4(pixels, dst->pitch, color, rect->w, rect->h);
break;
}