Don't use stack to save rbx register

This commit is contained in:
Jaroslav Kysela 2004-03-13 14:24:07 +00:00
parent be1c1d0a96
commit 7e07719af6

View file

@ -35,10 +35,12 @@ static void MIX_AREAS1(unsigned int size,
volatile signed int *sum, size_t dst_step, volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step) size_t src_step, size_t sum_step)
{ {
unsigned long long old_rbx;
/* /*
* ESI - src * RSI - src
* EDI - dst * RDI - dst
* EBX - sum * RBX - sum
* ECX - old sample * ECX - old sample
* EAX - sample / temporary * EAX - sample / temporary
* EDX - temporary * EDX - temporary
@ -46,9 +48,9 @@ static void MIX_AREAS1(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tpush %%rbx\n" "\tmovq %%rbx, %7\n"
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load RSI, RDI, RBX registers
*/ */
"\tmovq %1, %%rdi\n" "\tmovq %1, %%rdi\n"
"\tmovq %2, %%rsi\n" "\tmovq %2, %%rsi\n"
@ -106,16 +108,17 @@ static void MIX_AREAS1(unsigned int size,
"\tadd %6, %%rbx\n" "\tadd %6, %%rbx\n"
"\tdecl %0\n" "\tdecl %0\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"\tjmp 6f\n"
"6:" "6:"
"\temms\n" "\temms\n"
"\tpop %%rbx\n" "\tmovq %7, %%rbx\n"
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), "m" (sum), "m" (dst_step), "m" (src_step), "m" (sum_step) : "m" (size), "m" (dst), "m" (src),
: "rsi", "rdi", "edx", "ecx", "rbx", "eax" "m" (sum), "m" (dst_step), "m" (src_step),
"m" (sum_step), "m" (old_rbx)
: "rsi", "rdi", "edx", "ecx", "eax"
); );
} }
@ -127,10 +130,12 @@ static void MIX_AREAS2(unsigned int size,
volatile signed int *sum, size_t dst_step, volatile signed int *sum, size_t dst_step,
size_t src_step, size_t sum_step) size_t src_step, size_t sum_step)
{ {
unsigned long long old_rbx;
/* /*
* ESI - src * RSI - src
* EDI - dst * RDI - dst
* EBX - sum * RBX - sum
* ECX - old sample * ECX - old sample
* EAX - sample / temporary * EAX - sample / temporary
* EDX - temporary * EDX - temporary
@ -138,7 +143,7 @@ static void MIX_AREAS2(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tpush %%rbx\n" "\tmovq %%rbx, %7\n"
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load ESI, EDI, EBX registers
*/ */
@ -220,14 +225,15 @@ static void MIX_AREAS2(unsigned int size,
"\tadd %6, %%rbx\n" "\tadd %6, %%rbx\n"
"\tdecl %0\n" "\tdecl %0\n"
"\tjnz 1b\n" "\tjnz 1b\n"
// "\tjmp 6f\n"
"6:" "6:"
"\tpop %%rbx\n" "\tmovq %7, %%rbx\n"
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), "m" (sum), "m" (dst_step), "m" (src_step), "m" (sum_step) : "m" (size), "m" (dst), "m" (src),
: "rsi", "rdi", "edx", "ecx", "rbx", "eax" "m" (sum), "m" (dst_step), "m" (src_step),
"m" (sum_step), "m" (old_rbx)
: "rsi", "rdi", "edx", "ecx", "eax"
); );
} }