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.
This commit is contained in:
Sam Lantinga 2013-11-16 11:54:16 -08:00
parent 517747d536
commit 3b52058f6c
1 changed files with 0 additions and 117 deletions

View File

@ -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)
{
@ -372,12 +273,6 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
SDL_FillRect1SSE(pixels, dst->pitch, color, rect->w, rect->h);
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;
@ -391,12 +286,6 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
SDL_FillRect2SSE(pixels, dst->pitch, color, rect->w, rect->h);
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;
@ -416,12 +305,6 @@ SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
SDL_FillRect4SSE(pixels, dst->pitch, color, rect->w, rect->h);
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;