|
|
gcc 3.3 is a bit too smart here, It optimizes these variables away. However movd to a mmx register only works from reg or mem. -jsaw
--- SDL-1.2.6/src/video/SDL_RLEaccel.c 2003-08-30 21:13:06.000000000 +0200
+++ SDL-1.2.6-rock/src/video/SDL_RLEaccel.c 2004-02-23 18:11:50.000000000 +0100
@@ -143,7 +143,7 @@
do { \ Uint32 *srcp = (Uint32 *)(from); \ Uint32 *dstp = (Uint32 *)(to); \ - int i = 0x00FF00FF; \
+ volatile int i = 0x00FF00FF; \
movd_m2r(*(&i), mm3); \ punpckldq_r2r(mm3, mm3); \ i = 0xFF000000; \ @@ -213,10 +213,11 @@
#define ALPHA_BLIT16_565MMX(to, from, length, bpp, alpha) \ do { \ - int i, n = 0; \
+ volatile int i; \
+ int n = 0; \
Uint16 *srcp = (Uint16 *)(from); \ Uint16 *dstp = (Uint16 *)(to); \ - Uint32 ALPHA = 0xF800; \
+ volatile Uint32 ALPHA = 0xF800; \
movd_m2r(*(&ALPHA), mm1); \ punpcklwd_r2r(mm1, mm1); \ punpcklwd_r2r(mm1, mm1); \ @@ -229,7 +230,7 @@
punpcklwd_r2r(mm7, mm7); \ punpcklwd_r2r(mm7, mm7); \ alpha &= ~(1+2+4); \ - i = (Uint32)alpha | (Uint32)alpha << 16; \
+ *(&i) = (Uint32)alpha | (Uint32)alpha << 16; \
movd_m2r(*(&i), mm0); \ punpckldq_r2r(mm0, mm0); \ ALPHA = alpha >> 3; \ @@ -303,10 +304,11 @@
#define ALPHA_BLIT16_555MMX(to, from, length, bpp, alpha) \ do { \ - int i, n = 0; \
+ volatile int i; \
+ int n = 0; \
Uint16 *srcp = (Uint16 *)(from); \ Uint16 *dstp = (Uint16 *)(to); \ - Uint32 ALPHA = 0x7C00; \
+ volatile Uint32 ALPHA = 0x7C00; \
movd_m2r(*(&ALPHA), mm1); \ punpcklwd_r2r(mm1, mm1); \ punpcklwd_r2r(mm1, mm1); \ @@ -319,10 +321,10 @@
punpcklwd_r2r(mm7, mm7); \ punpcklwd_r2r(mm7, mm7); \ alpha &= ~(1+2+4); \ - i = (Uint32)alpha | (Uint32)alpha << 16; \
+ *(&i) = (Uint32)alpha | (Uint32)alpha << 16; \
movd_m2r(*(&i), mm0); \ punpckldq_r2r(mm0, mm0); \ - i = ((int)(length) & 3); \
+ i = ((int)(length) & 3); \
ALPHA = alpha >> 3; \ for(; i > 0; --i) { \ Uint32 s = *srcp++; \ @@ -524,7 +526,7 @@
do { \ Uint32 *srcp = (Uint32 *)(from); \ Uint32 *dstp = (Uint32 *)(to); \ - int i = 0x00fefefe; \
+ volatile int i = 0x00fefefe; \
movd_m2r(*(&i), mm4); \ punpckldq_r2r(mm4, mm4); \ i = 0x00010101; \
|