]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: dmix: assembly: change the token by symbolic names
authorFrédéric Recoules <frederic.recoules@orange.fr>
Wed, 6 May 2020 17:19:20 +0000 (19:19 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 6 May 2020 20:24:48 +0000 (22:24 +0200)
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>
src/pcm/pcm_dmix_i386.h
src/pcm/pcm_dmix_x86_64.h

index 2778cb1de270b55c6bf44a231e4144b9f0e1e2fa..e816d5e0d23a66d357033ac92d336d8273b14f1b 100644 (file)
@@ -47,14 +47,14 @@ static void MIX_AREAS_16(unsigned int size,
        __asm__ __volatile__ (
                "\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
                 */
-               "\tmovl %1, %%edi\n"
-               "\tmovl %2, %%esi\n"
-               "\tmovl %3, %%ebx\n"
-               "\tcmpl $0, %0\n"
+               "\tmovl %[dst], %%edi\n"
+               "\tmovl %[src], %%esi\n"
+               "\tmovl %[sum], %%ebx\n"
+               "\tcmpl $0, %[size]\n"
                "\tjnz 2f\n"
                "\tjmp 7f\n"
 
@@ -64,9 +64,9 @@ static void MIX_AREAS_16(unsigned int size,
                 */
                "\t.p2align 4,,15\n"
                "1:"
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
+               "\tadd %[dst_step], %%edi\n"
+               "\tadd %[src_step], %%esi\n"
+               "\tadd %[sum_step], %%ebx\n"
 
                /*
                 *   sample = *src;
@@ -108,7 +108,7 @@ static void MIX_AREAS_16(unsigned int size,
                /*
                 * while (size-- > 0)
                 */
-               "\tdecl %0\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
                "\tjmp 7f\n"
 
@@ -122,7 +122,7 @@ static void MIX_AREAS_16(unsigned int size,
                "\tmovw $0x7fff, (%%edi)\n"
                "\tcmpl %%ecx,(%%ebx)\n"
                "\tjnz 4b\n"
-               "\tdecl %0\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
                "\tjmp 7f\n"
 
@@ -136,16 +136,17 @@ static void MIX_AREAS_16(unsigned int size,
                "\tmovw $-0x8000, (%%edi)\n"
                "\tcmpl %%ecx, (%%ebx)\n"
                "\tjnz 4b\n"
-               "\tdecl %0\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
-               
+
                "7:"
-               "\tmovl %7, %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
+               "\tmovl %[old_ebx], %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_ebx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }
@@ -171,22 +172,22 @@ static void MIX_AREAS_16_MMX(unsigned int size,
        __asm__ __volatile__ (
                "\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
                 */
-               "\tmovl %1, %%edi\n"
-               "\tmovl %2, %%esi\n"
-               "\tmovl %3, %%ebx\n"
-               "\tcmpl $0, %0\n"
+               "\tmovl %[dst], %%edi\n"
+               "\tmovl %[src], %%esi\n"
+               "\tmovl %[sum], %%ebx\n"
+               "\tcmpl $0, %[size]\n"
                "\tjnz 2f\n"
                "\tjmp 5f\n"
 
                "\t.p2align 4,,15\n"
                "1:"
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
+               "\tadd %[dst_step], %%edi\n"
+               "\tadd %[src_step], %%esi\n"
+               "\tadd %[sum_step], %%ebx\n"
 
                "2:"
                /*
@@ -226,16 +227,17 @@ static void MIX_AREAS_16_MMX(unsigned int size,
                /*
                 * while (size-- > 0)
                 */
-               "\tdecl %0\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
                "\temms\n"
                 "5:"
-               "\tmovl %7, %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
+               "\tmovl %[old_ebx], %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_ebx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }
@@ -261,14 +263,14 @@ static void MIX_AREAS_32(unsigned int size,
        __asm__ __volatile__ (
                "\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
                 */
-               "\tmovl %1, %%edi\n"
-               "\tmovl %2, %%esi\n"
-               "\tmovl %3, %%ebx\n"
-               "\tcmpl $0, %0\n"
+               "\tmovl %[dst], %%edi\n"
+               "\tmovl %[src], %%esi\n"
+               "\tmovl %[sum], %%ebx\n"
+               "\tcmpl $0, %[size]\n"
                "\tjnz 1f\n"
                "\tjmp 6f\n"
 
@@ -335,20 +337,21 @@ static void MIX_AREAS_32(unsigned int size,
                /*
                 * while (size-- > 0)
                 */
-               "\tdecl %0\n"
+               "\tdecl %[size]\n"
                "\tjz 6f\n"
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
+               "\tadd %[dst_step], %%edi\n"
+               "\tadd %[src_step], %%esi\n"
+               "\tadd %[sum_step], %%ebx\n"
                "\tjmp 1b\n"
-               
+
                "6:"
-               "\tmovl %7, %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
+               "\tmovl %[old_ebx], %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_ebx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }
@@ -374,14 +377,14 @@ static void MIX_AREAS_24(unsigned int size,
        __asm__ __volatile__ (
                "\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
                 */
-               "\tmovl %1, %%edi\n"
-               "\tmovl %2, %%esi\n"
-               "\tmovl %3, %%ebx\n"
-               "\tcmpl $0, %0\n"
+               "\tmovl %[dst], %%edi\n"
+               "\tmovl %[src], %%esi\n"
+               "\tmovl %[sum], %%ebx\n"
+               "\tcmpl $0, %[size]\n"
                "\tjnz 1f\n"
                "\tjmp 6f\n"
 
@@ -441,20 +444,21 @@ static void MIX_AREAS_24(unsigned int size,
                /*
                 * while (size-- > 0)
                 */
-               "\tdecl %0\n"
+               "\tdecl %[size]\n"
                "\tjz 6f\n"
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
+               "\tadd %[dst_step], %%edi\n"
+               "\tadd %[src_step], %%esi\n"
+               "\tadd %[sum_step], %%ebx\n"
                "\tjmp 1b\n"
-               
+
                "6:"
-               "\tmovl %7, %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
+               "\tmovl %[old_ebx], %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_ebx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }
@@ -480,14 +484,14 @@ static void MIX_AREAS_24_CMOV(unsigned int size,
        __asm__ __volatile__ (
                "\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
                 */
-               "\tmovl %1, %%edi\n"
-               "\tmovl %2, %%esi\n"
-               "\tmovl %3, %%ebx\n"
-               "\tcmpl $0, %0\n"
+               "\tmovl %[dst], %%edi\n"
+               "\tmovl %[src], %%esi\n"
+               "\tmovl %[sum], %%ebx\n"
+               "\tcmpl $0, %[size]\n"
                "\tjz 6f\n"
 
                "\t.p2align 4,,15\n"
@@ -541,19 +545,20 @@ static void MIX_AREAS_24_CMOV(unsigned int size,
                /*
                 * while (size-- > 0)
                 */
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
-               "\tdecl %0\n"
+               "\tadd %[dst_step], %%edi\n"
+               "\tadd %[src_step], %%esi\n"
+               "\tadd %[sum_step], %%ebx\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
-               
+
                "6:"
-               "\tmovl %7, %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
+               "\tmovl %[old_ebx], %%ebx\n"    /* ebx is GOT pointer (-fPIC) */
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_ebx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }
index 1ef608afc32d1ca602100a0e0b0a16b70c65e26f..dc433b350fdcd2794fbad9775fde203c7a5106f9 100644 (file)
@@ -48,18 +48,18 @@ static void MIX_AREAS_16(unsigned int size,
        __asm__ __volatile__ (
                "\n"
 
-               "\tmovq %%rbx, %7\n"
+               "\tmovq %%rbx, %[old_rbx]\n"
                /*
                 *  initialization, load RSI, RDI, RBX registers
                 */
-               "\tmovq %1, %%rdi\n"
-               "\tmovq %2, %%rsi\n"
-               "\tmovq %3, %%rbx\n"
+               "\tmovq %[dst], %%rdi\n"
+               "\tmovq %[src], %%rsi\n"
+               "\tmovq %[sum], %%rbx\n"
 
                /*
                 * while (size-- > 0) {
                 */
-               "\tcmpl $0, %0\n"
+               "\tcmpl $0, %[size]\n"
                "jz 6f\n"
 
                "\t.p2align 4,,15\n"
@@ -103,21 +103,22 @@ static void MIX_AREAS_16(unsigned int size,
                /*
                 * while (size-- > 0)
                 */
-               "\tadd %4, %%rdi\n"
-               "\tadd %5, %%rsi\n"
-               "\tadd %6, %%rbx\n"
-               "\tdecl %0\n"
+               "\tadd %[dst_step], %%rdi\n"
+               "\tadd %[src_step], %%rsi\n"
+               "\tadd %[sum_step], %%rbx\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
 
                "6:"
-               
+
                "\temms\n"
-               "\tmovq %7, %%rbx\n"
+               "\tmovq %[old_rbx], %%rbx\n"
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_rbx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }
@@ -143,18 +144,18 @@ static void MIX_AREAS_32(unsigned int size,
        __asm__ __volatile__ (
                "\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 %2, %%rsi\n"
-               "\tmovq %3, %%rbx\n"
+               "\tmovq %[dst], %%rdi\n"
+               "\tmovq %[src], %%rsi\n"
+               "\tmovq %[sum], %%rbx\n"
 
                /*
                 * while (size-- > 0) {
                 */
-               "\tcmpl $0, %0\n"
+               "\tcmpl $0, %[size]\n"
                "jz 6f\n"
 
                "\t.p2align 4,,15\n"
@@ -220,19 +221,20 @@ static void MIX_AREAS_32(unsigned int size,
                /*
                 * while (size-- > 0)
                 */
-               "\tadd %4, %%rdi\n"
-               "\tadd %5, %%rsi\n"
-               "\tadd %6, %%rbx\n"
-               "\tdecl %0\n"
+               "\tadd %[dst_step], %%rdi\n"
+               "\tadd %[src_step], %%rsi\n"
+               "\tadd %[sum_step], %%rbx\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
-               
+
                "6:"
-               "\tmovq %7, %%rbx\n"
+               "\tmovq %[old_rbx], %%rbx\n"
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_rbx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }
@@ -258,18 +260,18 @@ static void MIX_AREAS_24(unsigned int size,
        __asm__ __volatile__ (
                "\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 %2, %%rsi\n"
-               "\tmovq %3, %%rbx\n"
+               "\tmovq %[dst], %%rdi\n"
+               "\tmovq %[src], %%rsi\n"
+               "\tmovq %[sum], %%rbx\n"
 
                /*
                 * while (size-- > 0) {
                 */
-               "\tcmpl $0, %0\n"
+               "\tcmpl $0, %[size]\n"
                "jz 6f\n"
 
                "\t.p2align 4,,15\n"
@@ -316,26 +318,27 @@ static void MIX_AREAS_24(unsigned int size,
                "\tmovw %%ax, (%%rdi)\n"
                "\tshrl $16, %%eax\n"
                "\tmovb %%al, 2(%%rdi)\n"
-       
+
                "\tcmpl %%ecx, (%%rbx)\n"
                "\tjnz 3b\n"
 
                /*
                 * while (size-- > 0)
                 */
-               "\tadd %4, %%rdi\n"
-               "\tadd %5, %%rsi\n"
-               "\tadd %6, %%rbx\n"
-               "\tdecl %0\n"
+               "\tadd %[dst_step], %%rdi\n"
+               "\tadd %[src_step], %%rsi\n"
+               "\tadd %[sum_step], %%rbx\n"
+               "\tdecl %[size]\n"
                "\tjnz 1b\n"
-               
+
                "6:"
-               "\tmovq %7, %%rbx\n"
+               "\tmovq %[old_rbx], %%rbx\n"
 
                : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src),
-                 "m" (sum), "m" (dst_step), "m" (src_step),
-                 "m" (sum_step), "m" (old_rbx)
+               : [size] "m" (size),
+                 [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
+                 [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"
        );
 }