pcm: dmix: assembly: change the token by symbolic names

It eases the refactoring of assembly chunk since we can now
add/remove/move entries without worrying about maintaining
the token numbering in the template.

Note: does not impact the binary output.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Frédéric Recoules 2020-05-06 19:19:20 +02:00 committed by Takashi Iwai
parent 21e2fc3857
commit b315f21bf7
2 changed files with 124 additions and 116 deletions

View file

@ -47,14 +47,14 @@ static void MIX_AREAS_16(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load ESI, EDI, EBX registers
*/ */
"\tmovl %1, %%edi\n" "\tmovl %[dst], %%edi\n"
"\tmovl %2, %%esi\n" "\tmovl %[src], %%esi\n"
"\tmovl %3, %%ebx\n" "\tmovl %[sum], %%ebx\n"
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"\tjnz 2f\n" "\tjnz 2f\n"
"\tjmp 7f\n" "\tjmp 7f\n"
@ -64,9 +64,9 @@ static void MIX_AREAS_16(unsigned int size,
*/ */
"\t.p2align 4,,15\n" "\t.p2align 4,,15\n"
"1:" "1:"
"\tadd %4, %%edi\n" "\tadd %[dst_step], %%edi\n"
"\tadd %5, %%esi\n" "\tadd %[src_step], %%esi\n"
"\tadd %6, %%ebx\n" "\tadd %[sum_step], %%ebx\n"
/* /*
* sample = *src; * sample = *src;
@ -108,7 +108,7 @@ static void MIX_AREAS_16(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"\tjmp 7f\n" "\tjmp 7f\n"
@ -122,7 +122,7 @@ static void MIX_AREAS_16(unsigned int size,
"\tmovw $0x7fff, (%%edi)\n" "\tmovw $0x7fff, (%%edi)\n"
"\tcmpl %%ecx,(%%ebx)\n" "\tcmpl %%ecx,(%%ebx)\n"
"\tjnz 4b\n" "\tjnz 4b\n"
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"\tjmp 7f\n" "\tjmp 7f\n"
@ -136,16 +136,17 @@ static void MIX_AREAS_16(unsigned int size,
"\tmovw $-0x8000, (%%edi)\n" "\tmovw $-0x8000, (%%edi)\n"
"\tcmpl %%ecx, (%%ebx)\n" "\tcmpl %%ecx, (%%ebx)\n"
"\tjnz 4b\n" "\tjnz 4b\n"
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"7:" "7:"
"\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_ebx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx)
: "esi", "edi", "edx", "ecx", "eax" : "esi", "edi", "edx", "ecx", "eax"
); );
} }
@ -171,22 +172,22 @@ static void MIX_AREAS_16_MMX(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load ESI, EDI, EBX registers
*/ */
"\tmovl %1, %%edi\n" "\tmovl %[dst], %%edi\n"
"\tmovl %2, %%esi\n" "\tmovl %[src], %%esi\n"
"\tmovl %3, %%ebx\n" "\tmovl %[sum], %%ebx\n"
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"\tjnz 2f\n" "\tjnz 2f\n"
"\tjmp 5f\n" "\tjmp 5f\n"
"\t.p2align 4,,15\n" "\t.p2align 4,,15\n"
"1:" "1:"
"\tadd %4, %%edi\n" "\tadd %[dst_step], %%edi\n"
"\tadd %5, %%esi\n" "\tadd %[src_step], %%esi\n"
"\tadd %6, %%ebx\n" "\tadd %[sum_step], %%ebx\n"
"2:" "2:"
/* /*
@ -226,16 +227,17 @@ static void MIX_AREAS_16_MMX(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"\temms\n" "\temms\n"
"5:" "5:"
"\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_ebx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx)
: "esi", "edi", "edx", "ecx", "eax" : "esi", "edi", "edx", "ecx", "eax"
); );
} }
@ -261,14 +263,14 @@ static void MIX_AREAS_32(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load ESI, EDI, EBX registers
*/ */
"\tmovl %1, %%edi\n" "\tmovl %[dst], %%edi\n"
"\tmovl %2, %%esi\n" "\tmovl %[src], %%esi\n"
"\tmovl %3, %%ebx\n" "\tmovl %[sum], %%ebx\n"
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"\tjnz 1f\n" "\tjnz 1f\n"
"\tjmp 6f\n" "\tjmp 6f\n"
@ -335,20 +337,21 @@ static void MIX_AREAS_32(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjz 6f\n" "\tjz 6f\n"
"\tadd %4, %%edi\n" "\tadd %[dst_step], %%edi\n"
"\tadd %5, %%esi\n" "\tadd %[src_step], %%esi\n"
"\tadd %6, %%ebx\n" "\tadd %[sum_step], %%ebx\n"
"\tjmp 1b\n" "\tjmp 1b\n"
"6:" "6:"
"\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_ebx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx)
: "esi", "edi", "edx", "ecx", "eax" : "esi", "edi", "edx", "ecx", "eax"
); );
} }
@ -374,14 +377,14 @@ static void MIX_AREAS_24(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load ESI, EDI, EBX registers
*/ */
"\tmovl %1, %%edi\n" "\tmovl %[dst], %%edi\n"
"\tmovl %2, %%esi\n" "\tmovl %[src], %%esi\n"
"\tmovl %3, %%ebx\n" "\tmovl %[sum], %%ebx\n"
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"\tjnz 1f\n" "\tjnz 1f\n"
"\tjmp 6f\n" "\tjmp 6f\n"
@ -441,20 +444,21 @@ static void MIX_AREAS_24(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjz 6f\n" "\tjz 6f\n"
"\tadd %4, %%edi\n" "\tadd %[dst_step], %%edi\n"
"\tadd %5, %%esi\n" "\tadd %[src_step], %%esi\n"
"\tadd %6, %%ebx\n" "\tadd %[sum_step], %%ebx\n"
"\tjmp 1b\n" "\tjmp 1b\n"
"6:" "6:"
"\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_ebx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx)
: "esi", "edi", "edx", "ecx", "eax" : "esi", "edi", "edx", "ecx", "eax"
); );
} }
@ -480,14 +484,14 @@ static void MIX_AREAS_24_CMOV(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovl %%ebx, %7\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %%ebx, %[old_ebx]\n" /* ebx is GOT pointer (-fPIC) */
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load ESI, EDI, EBX registers
*/ */
"\tmovl %1, %%edi\n" "\tmovl %[dst], %%edi\n"
"\tmovl %2, %%esi\n" "\tmovl %[src], %%esi\n"
"\tmovl %3, %%ebx\n" "\tmovl %[sum], %%ebx\n"
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"\tjz 6f\n" "\tjz 6f\n"
"\t.p2align 4,,15\n" "\t.p2align 4,,15\n"
@ -541,19 +545,20 @@ static void MIX_AREAS_24_CMOV(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tadd %4, %%edi\n" "\tadd %[dst_step], %%edi\n"
"\tadd %5, %%esi\n" "\tadd %[src_step], %%esi\n"
"\tadd %6, %%ebx\n" "\tadd %[sum_step], %%ebx\n"
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"6:" "6:"
"\tmovl %7, %%ebx\n" /* ebx is GOT pointer (-fPIC) */ "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_ebx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_ebx] "m" (old_ebx)
: "esi", "edi", "edx", "ecx", "eax" : "esi", "edi", "edx", "ecx", "eax"
); );
} }

View file

@ -48,18 +48,18 @@ static void MIX_AREAS_16(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovq %%rbx, %7\n" "\tmovq %%rbx, %[old_rbx]\n"
/* /*
* initialization, load RSI, RDI, RBX registers * initialization, load RSI, RDI, RBX registers
*/ */
"\tmovq %1, %%rdi\n" "\tmovq %[dst], %%rdi\n"
"\tmovq %2, %%rsi\n" "\tmovq %[src], %%rsi\n"
"\tmovq %3, %%rbx\n" "\tmovq %[sum], %%rbx\n"
/* /*
* while (size-- > 0) { * while (size-- > 0) {
*/ */
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"jz 6f\n" "jz 6f\n"
"\t.p2align 4,,15\n" "\t.p2align 4,,15\n"
@ -103,21 +103,22 @@ static void MIX_AREAS_16(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tadd %4, %%rdi\n" "\tadd %[dst_step], %%rdi\n"
"\tadd %5, %%rsi\n" "\tadd %[src_step], %%rsi\n"
"\tadd %6, %%rbx\n" "\tadd %[sum_step], %%rbx\n"
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"6:" "6:"
"\temms\n" "\temms\n"
"\tmovq %7, %%rbx\n" "\tmovq %[old_rbx], %%rbx\n"
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_rbx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_rbx] "m" (old_rbx)
: "rsi", "rdi", "edx", "ecx", "eax" : "rsi", "rdi", "edx", "ecx", "eax"
); );
} }
@ -143,18 +144,18 @@ static void MIX_AREAS_32(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovq %%rbx, %7\n" "\tmovq %%rbx, %[old_rbx]\n"
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load RSI, RDI, RBX registers
*/ */
"\tmovq %1, %%rdi\n" "\tmovq %[dst], %%rdi\n"
"\tmovq %2, %%rsi\n" "\tmovq %[src], %%rsi\n"
"\tmovq %3, %%rbx\n" "\tmovq %[sum], %%rbx\n"
/* /*
* while (size-- > 0) { * while (size-- > 0) {
*/ */
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"jz 6f\n" "jz 6f\n"
"\t.p2align 4,,15\n" "\t.p2align 4,,15\n"
@ -220,19 +221,20 @@ static void MIX_AREAS_32(unsigned int size,
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tadd %4, %%rdi\n" "\tadd %[dst_step], %%rdi\n"
"\tadd %5, %%rsi\n" "\tadd %[src_step], %%rsi\n"
"\tadd %6, %%rbx\n" "\tadd %[sum_step], %%rbx\n"
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"6:" "6:"
"\tmovq %7, %%rbx\n" "\tmovq %[old_rbx], %%rbx\n"
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_rbx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_rbx] "m" (old_rbx)
: "rsi", "rdi", "edx", "ecx", "eax" : "rsi", "rdi", "edx", "ecx", "eax"
); );
} }
@ -258,18 +260,18 @@ static void MIX_AREAS_24(unsigned int size,
__asm__ __volatile__ ( __asm__ __volatile__ (
"\n" "\n"
"\tmovq %%rbx, %7\n" "\tmovq %%rbx, %[old_rbx]\n"
/* /*
* initialization, load ESI, EDI, EBX registers * initialization, load RSI, RDI, RBX registers
*/ */
"\tmovq %1, %%rdi\n" "\tmovq %[dst], %%rdi\n"
"\tmovq %2, %%rsi\n" "\tmovq %[src], %%rsi\n"
"\tmovq %3, %%rbx\n" "\tmovq %[sum], %%rbx\n"
/* /*
* while (size-- > 0) { * while (size-- > 0) {
*/ */
"\tcmpl $0, %0\n" "\tcmpl $0, %[size]\n"
"jz 6f\n" "jz 6f\n"
"\t.p2align 4,,15\n" "\t.p2align 4,,15\n"
@ -316,26 +318,27 @@ static void MIX_AREAS_24(unsigned int size,
"\tmovw %%ax, (%%rdi)\n" "\tmovw %%ax, (%%rdi)\n"
"\tshrl $16, %%eax\n" "\tshrl $16, %%eax\n"
"\tmovb %%al, 2(%%rdi)\n" "\tmovb %%al, 2(%%rdi)\n"
"\tcmpl %%ecx, (%%rbx)\n" "\tcmpl %%ecx, (%%rbx)\n"
"\tjnz 3b\n" "\tjnz 3b\n"
/* /*
* while (size-- > 0) * while (size-- > 0)
*/ */
"\tadd %4, %%rdi\n" "\tadd %[dst_step], %%rdi\n"
"\tadd %5, %%rsi\n" "\tadd %[src_step], %%rsi\n"
"\tadd %6, %%rbx\n" "\tadd %[sum_step], %%rbx\n"
"\tdecl %0\n" "\tdecl %[size]\n"
"\tjnz 1b\n" "\tjnz 1b\n"
"6:" "6:"
"\tmovq %7, %%rbx\n" "\tmovq %[old_rbx], %%rbx\n"
: /* no output regs */ : /* no output regs */
: "m" (size), "m" (dst), "m" (src), : [size] "m" (size),
"m" (sum), "m" (dst_step), "m" (src_step), [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
"m" (sum_step), "m" (old_rbx) [dst_step] "m" (dst_step), [src_step] "m" (src_step),
[sum_step] "m" (sum_step), [old_rbx] "m" (old_rbx)
: "rsi", "rdi", "edx", "ecx", "eax" : "rsi", "rdi", "edx", "ecx", "eax"
); );
} }