diff --git a/Sources/Engine/Light/LayerMixer.cpp b/Sources/Engine/Light/LayerMixer.cpp index 6f1d5ad..d2aff1d 100755 --- a/Sources/Engine/Light/LayerMixer.cpp +++ b/Sources/Engine/Light/LayerMixer.cpp @@ -365,9 +365,9 @@ skipPixel: } #elif (defined __GNU_INLINE__) + ULONG tmp1, tmp2; __asm__ __volatile__ ( // prepare interpolants - "pushl %%ebx \n\t" "movd (" ASMSYM(_slL2Row) "), %%mm0 \n\t" "movd (" ASMSYM(_slDL2oDURow) "), %%mm1 \n\t" "psllq $32, %%mm1 \n\t" @@ -378,26 +378,25 @@ skipPixel: "por %%mm0, %%mm2 \n\t" // MM2 = slDDL2oDUoDV | slDL2oDV // prepare color "pxor %%mm0, %%mm0 \n\t" - "movd %%eax, %%mm7 \n\t" + "movd %[ulLightRGB], %%mm7 \n\t" "punpcklbw %%mm0, %%mm7 \n\t" "psllw $1, %%mm7 \n\t" // loop thru rows "movl (" ASMSYM(_pulLayer) "), %%edi \n\t" - "movl (" ASMSYM(_iRowCt) "), %%ebx \n\t" + "movl (" ASMSYM(_iRowCt) "), %[xbx] \n\t" "0: \n\t" // rowLoop - "pushl %%ebx \n\t" - "movd %%mm1, %%ebx \n\t" // EBX = slL2Point + "movd %%mm1, %[slL2Point] \n\t" "movq %%mm1, %%mm3 \n\t" "psrlq $32, %%mm3 \n\t" // MM3 = 0 | slDL2oDU // loop thru pixels in current row "movl (" ASMSYM(_iPixCt) "), %%ecx \n\t" "1: \n\t" // pixLoop // check if pixel need to be drawn - "cmpl $0x10000000, %%ebx \n\t" + "cmpl $0x10000000, %[slL2Point] \n\t" "jge 3f \n\t" // skipPixel // calculate intensities and do actual drawing of shadow pixel ARGB "movd %%ecx, %%mm4 \n\t" - "movl %%ebx, %%eax \n\t" + "movl %[slL2Point], %%eax \n\t" "sarl $15, %%eax \n\t" "andl $8191, %%eax \n\t" "movzbl " ASMSYM(aubSqrt) "(%%eax), %%eax \n\t" @@ -424,22 +423,20 @@ skipPixel: // advance to next pixel "addl $4, %%edi \n\t" "movd %%mm3, %%eax \n\t" - "addl %%eax, %%ebx \n\t" + "addl %%eax, %[slL2Point] \n\t" "paddd (" ASMSYM(mmDDL2oDU_AddAmbientPoint) "), %%mm3 \n\t" "decl %%ecx \n\t" "jnz 1b \n\t" // pixLoop // advance to the next row - "popl %%ebx \n\t" "addl (" ASMSYM(_slModulo) "), %%edi \n\t" "paddd %%mm2, %%mm1 \n\t" "paddd (" ASMSYM(mmDDL2oDV_AddAmbientPoint) "), %%mm2 \n\t" - "decl %%ebx \n\t" + "decl %[xbx] \n\t" "jnz 0b \n\t" // rowLoop - "popl %%ebx \n\t" "emms \n\t" - : // no outputs. - : "a" (ulLightRGB) - : "ecx", "edx", "edi", "esi", "cc", "memory" + : [xbx] "=&r" (tmp1), [slL2Point] "=&g" (tmp2) + : [ulLightRGB] "g" (ulLightRGB) + : FPU_REGS, MMX_REGS, "eax", "ecx", "edi", "cc", "memory" ); #else @@ -580,10 +577,9 @@ skipPixel: } #elif (defined __GNU_INLINE__) + ULONG tmp1, tmp2; __asm__ __volatile__ ( // prepare interpolants - "pushl %%ebx \n\t" - "movl %%ecx, %%ebx \n\t" "movd (" ASMSYM(_slL2Row) "), %%mm0 \n\t" "movd (" ASMSYM(_slDL2oDURow) "), %%mm1 \n\t" "psllq $32, %%mm1 \n\t" @@ -594,29 +590,30 @@ skipPixel: "por %%mm0, %%mm2 \n\t" // MM2 = slDDL2oDUoDV | slDL2oDV // prepare color "pxor %%mm0, %%mm0 \n\t" // MM0 = 0 | 0 (for unpacking purposes) - "movd %%eax, %%mm7 \n\t" // eax == ulLightRGB + "movd %[ulLightRGB], %%mm7 \n\t" "punpcklbw %%mm0, %%mm7 \n\t" "psllw $1, %%mm7 \n\t" // loop thru rows + "movl %[pubMask], %%esi \n\t" "movl (" ASMSYM(_pulLayer) "), %%edi \n\t" - "movzbl (%%ebx), %%edx \n\t" // ebx == &ubMask - "movl (" ASMSYM(_iRowCt) "), %%ebx \n\t" + "movzbl %[ubMask], %%edx \n\t" + "movl (" ASMSYM(_iRowCt) "), %%eax \n\t" + "movl %%eax, %[xbx] \n\t" "0: \n\t" // rowLoop - "pushl %%ebx \n\t" - "movd %%mm1, %%ebx \n\t" // EBX = slL2Point + "movd %%mm1, %[slL2Point] \n\t" "movq %%mm1, %%mm3 \n\t" "psrlq $32, %%mm3 \n\t" // MM3 = 0 | slDL2oDU // loop thru pixels in current row "movl (" ASMSYM(_iPixCt) "), %%ecx \n\t" "1: \n\t" // pixLoop // check if pixel need to be drawn; i.e. draw if( [esi] & ubMask && (slL2Pointlm_pixCanvasSizeU), "S" (this->lm_pixCanvasSizeV), "a" (colAmbient), "D" (this->lm_pulShadowMap) : "cc", "memory" @@ -1977,12 +1968,13 @@ __forceinline void CLayerMixer::CopyShadowLayer(void) rep movsd } #elif (defined __GNU_INLINE__) + ULONG clob1, clob2, clob3; __asm__ __volatile__ ( "cld \n\t" "imull %%eax, %%ecx \n\t" "rep \n\t" "movsl \n\t" - : // no outputs. + : "=c" (clob1), "=S" (clob2), "=D" (clob3) : "c" (this->lm_pixCanvasSizeU), "a" (this->lm_pixCanvasSizeV), "S" (this->lm_pulStaticShadowMap), "D" (this->lm_pulShadowMap) : "cc", "memory" @@ -2015,13 +2007,14 @@ __forceinline void CLayerMixer::FillShadowLayer( COLOR col) } #elif (defined __GNU_INLINE__) + ULONG clob1, clob2, clob3; __asm__ __volatile__ ( "cld \n\t" "imull %%edx, %%ecx \n\t" "bswapl %%eax \n\t" // convert to R,G,B,A memory format! "rep \n\t" "stosl \n\t" - : // no outputs. + : "=a" (clob1), "=c" (clob2), "=D" (clob3) : "c" (this->lm_pixCanvasSizeU), "d" (this->lm_pixCanvasSizeV), "a" (col), "D" (this->lm_pulShadowMap) : "cc", "memory"