Update of /cvsroot/alsa/alsa-lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv8826

Modified Files:
        code.c 
Log Message:
Use asm code directly from src/pcm/pcm_dmix_i386.h

Index: code.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/test/code.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- code.c      28 Feb 2003 20:33:42 -0000      1.9
+++ code.c      1 Mar 2003 11:16:42 -0000       1.10
@@ -56,7 +56,7 @@
 
 #define cmpxchg(ptr,o,n)\
        ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
-                                       (unsigned long)(n),sizeof(*(ptr))))
+                                      (unsigned long)(n),sizeof(*(ptr))))
 
 static inline void atomic_add(volatile int *dst, int v)
 {
@@ -135,214 +135,11 @@
        }
 }
 
-void mix_areas1(unsigned int size,
-               volatile s16 *dst, s16 *src,
-               volatile s32 *sum, unsigned int dst_step,
-               unsigned int src_step, unsigned int sum_step)
-{
-       /*
-        *  ESI - src
-        *  EDI - dst
-        *  EBX - sum
-        *  ECX - old sample
-        *  EAX - sample / temporary
-        *  EDX - temporary
-        */
-       __asm__ __volatile__ (
-               "\n"
-
-               /*
-                *  initialization, load ESI, EDI, EBX registers
-                */
-               "\tmovl %1, %%edi\n"
-               "\tmovl %2, %%esi\n"
-               "\tmovl %3, %%ebx\n"
-
-               /*
-                * while (size-- > 0) {
-                */
-               "\tcmp $0, %0\n"
-               "jz 6f\n"
-
-               "\t.p2align 4,,15\n"
-
-               "1:"
-
-               /*
-                *   sample = *src;
-                *   sum_sample = *sum;
-                *   if (cmpxchg(*dst, 0, 1) == 0)
-                *     sample -= sum_sample;
-                *   xadd(*sum, sample);
-                */
-               "\tmovw $0, %%ax\n"
-               "\tmovw $1, %%cx\n"
-               "\tmovl (%%ebx), %%edx\n"
-               "\t" LOCK_PREFIX "cmpxchgw %%cx, (%%edi)\n"
-               "\tmovswl (%%esi), %%ecx\n"
-               "\tjnz 2f\n"
-               "\tsubl %%edx, %%ecx\n"
-               "2:"
-               "\t" LOCK_PREFIX "addl %%ecx, (%%ebx)\n"
-
-               /*
-                *   do {
-                *     sample = old_sample = *sum;
-                *     saturate(v);
-                *     *dst = sample;
-                *   } while (v != *sum);
-                */
-
-               "3:"
-               "\tmovl (%%ebx), %%ecx\n"
-               "\tcmpl $0x7fff,%%ecx\n"
-               "\tjg 4f\n"
-               "\tcmpl $-0x8000,%%ecx\n"
-               "\tjl 5f\n"
-               "\tmovw %%cx, (%%edi)\n"
-               "\tcmpl %%ecx, (%%ebx)\n"
-               "\tjnz 3b\n"
-
-               /*
-                * while (size-- > 0)
-                */
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
-               "\tdecl %0\n"
-               "\tjnz 1b\n"
-               "\tjmp 6f\n"
-
-               /*
-                *  sample > 0x7fff
-                */
-
-               "\t.p2align 4,,15\n"
-
-               "4:"
-               "\tmovw $0x7fff, (%%edi)\n"
-               "\tcmpl %%ecx,(%%ebx)\n"
-               "\tjnz 3b\n"
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
-               "\tdecl %0\n"
-               "\tjnz 1b\n"
-               "\tjmp 6f\n"
-
-               /*
-                *  sample < -0x8000
-                */
-
-               "\t.p2align 4,,15\n"
-
-               "5:"
-               "\tmovw $-0x8000, (%%edi)\n"
-               "\tcmpl %%ecx, (%%ebx)\n"
-               "\tjnz 3b\n"
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
-               "\tdecl %0\n"
-               "\tjnz 1b\n"
-               // "\tjmp 6f\n"
-               
-               "6:"
-
-               : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src), "m" (sum), "m" (dst_step), "m" 
(src_step), "m" (sum_step)
-               : "esi", "edi", "edx", "ecx", "ebx", "eax"
-       );
-}
-
-
-void mix_areas1_mmx(unsigned int size,
-                   volatile s16 *dst, s16 *src,
-                   volatile s32 *sum, unsigned int dst_step,
-                   unsigned int src_step, unsigned int sum_step)
-{
-       /*
-        *  ESI - src
-        *  EDI - dst
-        *  EBX - sum
-        *  ECX - old sample
-        *  EAX - sample / temporary
-        *  EDX - temporary
-        */
-       __asm__ __volatile__ (
-               "\n"
-
-               /*
-                *  initialization, load ESI, EDI, EBX registers
-                */
-               "\tmovl %1, %%edi\n"
-               "\tmovl %2, %%esi\n"
-               "\tmovl %3, %%ebx\n"
-
-               /*
-                * while (size-- > 0) {
-                */
-               "\tcmp $0, %0\n"
-               "\tjz 6f\n"
-
-               "\t.p2align 4,,15\n"
-
-               "1:"
-
-               /*
-                *   sample = *src;
-                *   sum_sample = *sum;
-                *   if (cmpxchg(*dst, 0, 1) == 0)
-                *     sample -= sum_sample;
-                *   xadd(*sum, sample);
-                */
-               "\tmovw $0, %%ax\n"
-               "\tmovw $1, %%cx\n"
-               "\tmovl (%%ebx), %%edx\n"
-               "\t" LOCK_PREFIX "cmpxchgw %%cx, (%%edi)\n"
-               "\tmovswl (%%esi), %%ecx\n"
-               "\tjnz 2f\n"
-               "\tsubl %%edx, %%ecx\n"
-               "2:"
-               "\t" LOCK_PREFIX "addl %%ecx, (%%ebx)\n"
-
-               /*
-                *   do {
-                *     sample = old_sample = *sum;
-                *     saturate(v);
-                *     *dst = sample;
-                *   } while (v != *sum);
-                */
-
-               "3:"
-               "\tmovl (%%ebx), %%ecx\n"
-               "\tmovd %%ecx, %%mm0\n"
-               "\tpackssdw %%mm1, %%mm0\n"
-               "\tmovd %%mm0, %%eax\n"
-               "\tmovw %%ax, (%%edi)\n"
-               "\tcmpl %%ecx, (%%ebx)\n"
-               "\tjnz 3b\n"
-
-               /*
-                * while (size-- > 0)
-                */
-               "\tadd %4, %%edi\n"
-               "\tadd %5, %%esi\n"
-               "\tadd %6, %%ebx\n"
-               "\tdecl %0\n"
-               "\tjnz 1b\n"
-               "\tjmp 6f\n"
-               
-               "6:"
-
-               "\temms\n"
-
-               : /* no output regs */
-               : "m" (size), "m" (dst), "m" (src), "m" (sum), "m" (dst_step), "m" 
(src_step), "m" (sum_step)
-               : "esi", "edi", "edx", "ecx", "ebx", "eax"
-       );
-}
-
+#define MIX_AREAS1 mix_areas1
+#define MIX_AREAS1_MMX mix_areas1_mmx
+#include "../src/pcm/pcm_dmix_i386.h"
+#undef MIX_AREAS1
+#undef MIX_AREAS1_MMX
 
 void mix_areas2(unsigned int size,
                volatile s16 *dst, const s16 *src,



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to