mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-25 03:40:26 +01:00
fix SoundMixer asm
SoundMixer386.asm forgot to save some callee-save registers too
This commit is contained in:
parent
b1837c2e58
commit
52c178718c
|
@ -96,11 +96,12 @@ void ResetMixer( const SLONG *pslBuffer, const SLONG slBufferSize)
|
||||||
}
|
}
|
||||||
#elif (defined __GNU_INLINE__)
|
#elif (defined __GNU_INLINE__)
|
||||||
// !!! FIXME : rcg12172001 Is this REALLY any faster than memset()?
|
// !!! FIXME : rcg12172001 Is this REALLY any faster than memset()?
|
||||||
|
ULONG clob1, clob2;
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"cld \n\t"
|
"cld \n\t"
|
||||||
"rep \n\t"
|
"rep \n\t"
|
||||||
"stosl \n\t"
|
"stosl \n\t"
|
||||||
: // no outputs.
|
: "=D" (clob1), "=c" (clob2)
|
||||||
: "a" (0), "D" (pvMixerBuffer), "c" (slMixerBufferSize*2)
|
: "a" (0), "D" (pvMixerBuffer), "c" (slMixerBufferSize*2)
|
||||||
: "cc", "memory"
|
: "cc", "memory"
|
||||||
);
|
);
|
||||||
|
@ -132,11 +133,12 @@ void CopyMixerBuffer_stereo( const SLONG slSrcOffset, void *pDstBuffer, const SL
|
||||||
}
|
}
|
||||||
#elif (defined __GNU_INLINE__)
|
#elif (defined __GNU_INLINE__)
|
||||||
// !!! FIXME : rcg12172001 Is this REALLY any faster than memcpy()?
|
// !!! FIXME : rcg12172001 Is this REALLY any faster than memcpy()?
|
||||||
|
ULONG clob1, clob2, clob3;
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"cld \n\t"
|
"cld \n\t"
|
||||||
"rep \n\t"
|
"rep \n\t"
|
||||||
"movsl \n\t"
|
"movsl \n\t"
|
||||||
: // no outputs.
|
: "=S" (clob1), "=D" (clob2), "=c" (clob3)
|
||||||
: "S" (((char *)pvMixerBuffer) + slSrcOffset),
|
: "S" (((char *)pvMixerBuffer) + slSrcOffset),
|
||||||
"D" (pDstBuffer),
|
"D" (pDstBuffer),
|
||||||
"c" (slBytes >> 2)
|
"c" (slBytes >> 2)
|
||||||
|
@ -184,6 +186,9 @@ copyLoop:
|
||||||
|
|
||||||
#elif (defined __GNU_INLINE__)
|
#elif (defined __GNU_INLINE__)
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
|
"movl %[pvMixerBuffer], %%esi \n\t"
|
||||||
|
"movl %[pDstBuffer], %%edi \n\t"
|
||||||
|
"movl %[slDW], %%ecx \n\t"
|
||||||
"0: \n\t" // copyLoop
|
"0: \n\t" // copyLoop
|
||||||
"movzwl (%%esi), %%eax \n\t"
|
"movzwl (%%esi), %%eax \n\t"
|
||||||
"movw %%ax, (%%edi) \n\t"
|
"movw %%ax, (%%edi) \n\t"
|
||||||
|
@ -192,10 +197,10 @@ copyLoop:
|
||||||
"decl %%ecx \n\t"
|
"decl %%ecx \n\t"
|
||||||
"jnz 0b \n\t" // copyLoop
|
"jnz 0b \n\t" // copyLoop
|
||||||
: // no outputs.
|
: // no outputs.
|
||||||
: "S" (((char *)pvMixerBuffer) + slSrcOffset),
|
: [pvMixerBuffer] "g" (((char *)pvMixerBuffer) + slSrcOffset),
|
||||||
"D" (pDstBuffer),
|
[pDstBuffer] "g" (pDstBuffer),
|
||||||
"c" (slBytes >> 2)
|
[slDW] "g" (slBytes >> 2)
|
||||||
: "cc", "memory", "eax"
|
: "eax", "ecx", "esi", "edi", "cc", "memory"
|
||||||
);
|
);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -247,6 +252,9 @@ copyLoop:
|
||||||
|
|
||||||
#elif (defined __GNU_INLINE__)
|
#elif (defined __GNU_INLINE__)
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
|
"movl %[pvMixerBuffer], %%esi \n\t"
|
||||||
|
"movl %[pvMixerBuffer], %%edi \n\t"
|
||||||
|
"movl %[slDW], %%ecx \n\t"
|
||||||
"cld \n\t"
|
"cld \n\t"
|
||||||
"0: \n\t" // copyLoop
|
"0: \n\t" // copyLoop
|
||||||
"movq (%%esi), %%mm0 \n\t"
|
"movq (%%esi), %%mm0 \n\t"
|
||||||
|
@ -258,8 +266,8 @@ copyLoop:
|
||||||
"jnz 0b \n\t" // copyLoop
|
"jnz 0b \n\t" // copyLoop
|
||||||
"emms \n\t"
|
"emms \n\t"
|
||||||
: // no outputs.
|
: // no outputs.
|
||||||
: "S" (pvMixerBuffer), "D" (pvMixerBuffer), "c" (slBytes >> 2)
|
: [pvMixerBuffer] "g" (pvMixerBuffer), [slDW] "g" (slBytes >> 2)
|
||||||
: "cc", "memory"
|
: FPU_REGS, "mm0", "ecx", "esi", "edi", "cc", "memory"
|
||||||
);
|
);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -96,6 +96,8 @@ SEGMENT .text
|
||||||
global MixMono_asm
|
global MixMono_asm
|
||||||
MixMono_asm:
|
MixMono_asm:
|
||||||
push ebx ; Save GCC register.
|
push ebx ; Save GCC register.
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
; convert from floats to fixints 32:16
|
; convert from floats to fixints 32:16
|
||||||
fld D [fLeftOfs]
|
fld D [fLeftOfs]
|
||||||
fmul D [f65536]
|
fmul D [f65536]
|
||||||
|
@ -224,6 +226,8 @@ loopEnd_MixMono:
|
||||||
shr edx,16
|
shr edx,16
|
||||||
mov D [slLastLeftSample],eax
|
mov D [slLastLeftSample],eax
|
||||||
mov D [slLastRightSample],edx
|
mov D [slLastRightSample],edx
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebx ; Restore GCC register.
|
pop ebx ; Restore GCC register.
|
||||||
emms
|
emms
|
||||||
ret
|
ret
|
||||||
|
@ -232,6 +236,8 @@ loopEnd_MixMono:
|
||||||
global MixStereo_asm
|
global MixStereo_asm
|
||||||
MixStereo_asm:
|
MixStereo_asm:
|
||||||
push ebx ; Save GCC register.
|
push ebx ; Save GCC register.
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
; convert from floats to fixints 32:16
|
; convert from floats to fixints 32:16
|
||||||
fld D [fLeftOfs]
|
fld D [fLeftOfs]
|
||||||
fmul D [f65536]
|
fmul D [f65536]
|
||||||
|
@ -363,6 +369,8 @@ loopEnd_MixStereo:
|
||||||
mov D [slLastLeftSample],eax
|
mov D [slLastLeftSample],eax
|
||||||
mov D [slLastRightSample],edx
|
mov D [slLastRightSample],edx
|
||||||
emms
|
emms
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
pop ebx ; Restore GCC register.
|
pop ebx ; Restore GCC register.
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user