|
|
| version 1.4, 2003/11/28 16:31:08 | version 1.9, 2005/03/12 12:36:13 |
|---|---|
| Line 10 | Line 10 |
| * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the | * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. | * documentation and/or other materials provided with the distribution. |
| * 3. The name of the author may not be used to endorse or promote products | |
| * derived from this software without specific prior written permission. | |
| * | * |
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| Line 94 static BOOL nosound_setup(void); | Line 92 static BOOL nosound_setup(void); |
| static void PARTSCALL (*fnmix)(SINT16* dst, const SINT32* src, UINT size); | static void PARTSCALL (*fnmix)(SINT16* dst, const SINT32* src, UINT size); |
| #if defined(__GNUC__) && (defined(i386) || defined(__i386__)) | #if defined(GCC_CPU_ARCH_IA32) |
| void PARTSCALL _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size); | void PARTSCALL _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size); |
| void PARTSCALL _saturation_s16x(SINT16 *dst, const SINT32 *src, UINT size); | void PARTSCALL _saturation_s16x(SINT16 *dst, const SINT32 *src, UINT size); |
| void PARTSCALL saturation_s16mmx(SINT16 *dst, const SINT32 *src, UINT size); | void PARTSCALL saturation_s16mmx(SINT16 *dst, const SINT32 *src, UINT size); |
| Line 141 calc_fragment(UINT size) | Line 139 calc_fragment(UINT size) |
| return f; | return f; |
| } | } |
| void | static void |
| snddrv_setup(void) | snddrv_setup(void) |
| { | { |
| Line 349 void | Line 347 void |
| soundmng_setreverse(BOOL reverse) | soundmng_setreverse(BOOL reverse) |
| { | { |
| #if defined(__GNUC__) && (defined(i386) || defined(__i386__)) | #if defined(GCC_CPU_ARCH_AMD64) |
| if (!reverse) { | |
| if (mmxflag & (MMXFLAG_NOTSUPPORT|MMXFLAG_DISABLE)) { | |
| fnmix = satuation_s16; | |
| } else { | |
| fnmix = saturation_s16mmx; | |
| } | |
| } else { | |
| fnmix = satuation_s16x; | |
| } | |
| #elif defined(GCC_CPU_ARCH_IA32) | |
| if (!reverse) { | if (!reverse) { |
| if (mmxflag & (MMXFLAG_NOTSUPPORT|MMXFLAG_DISABLE)) { | if (mmxflag & (MMXFLAG_NOTSUPPORT|MMXFLAG_DISABLE)) { |
| fnmix = _saturation_s16; | fnmix = _saturation_s16; |
| Line 646 snddrv_stop(void) | Line 654 snddrv_stop(void) |
| #endif /* USE_NETBSDAUDIO || USE_OSSAUDIO || USE_ESDAUDIO */ | #endif /* USE_NETBSDAUDIO || USE_OSSAUDIO || USE_ESDAUDIO */ |
| #if defined(__GNUC__) && (defined(i386) || defined(__i386__)) | #if defined(GCC_CPU_ARCH_AMD64) |
| void PARTSCALL | |
| _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size) | |
| { | |
| asm volatile ( | |
| "movq %0, %%rcx;" | |
| "movq %1, %%rdx;" | |
| "movl %2, %%ebx;" | |
| "shrl $1, %%ebx;" | |
| "je .ss16_ed;" | |
| ".ss16_lp:" | |
| "movl (%%rdx), %%eax;" | |
| "cmpl $0x000008000, %%eax;" | |
| "jl .ss16_min;" | |
| "movw $0x7fff, %%ax;" | |
| "jmp .ss16_set;" | |
| ".ss16_min:" | |
| "cmpl $0x0ffff8000, %%eax;" | |
| "jg .ss16_set;" | |
| "movw $0x8001, %%ax;" | |
| ".ss16_set:" | |
| "leal 4(%%rdx), %%edx;" | |
| "movw %%ax, (%%rcx);" | |
| "decl %%ebx;" | |
| "leal 2(%%rcx), %%ecx;" | |
| "jne .ss16_lp;" | |
| ".ss16_ed:" | |
| : /* output */ | |
| : "m" (dst), "m" (src), "m" (size) | |
| : "ebx"); | |
| } | |
| void PARTSCALL | |
| _saturation_s16x(SINT16 *dst, const SINT32 *src, UINT size) | |
| { | |
| asm volatile ( | |
| "movq %0, %%rcx;" | |
| "movq %1, %%rdx;" | |
| "movl %2, %%ebx;" | |
| "shrl $2, %%ebx;" | |
| "je .ss16x_ed;" | |
| ".ss16x_lp:" | |
| "movl (%%rdx), %%eax;" | |
| "cmpl $0x000008000, %%eax;" | |
| "jl .ss16xl_min;" | |
| "movw $0x7fff, %%ax;" | |
| "jmp .ss16xl_set;" | |
| ".ss16xl_min:" | |
| "cmpl $0x0ffff8000, %%eax;" | |
| "jg .ss16xl_set;" | |
| "movw $0x8001, %%ax;" | |
| ".ss16xl_set:" | |
| "movw %%ax, 2(%%rcx);" | |
| "movl 4(%%rdx), %%eax;" | |
| "cmpl $0x000008000, %%eax;" | |
| "jl .ss16xr_min;" | |
| "movw $0x7fff, %%ax;" | |
| "jmp .ss16xr_set;" | |
| ".ss16xr_min:" | |
| "cmpl $0x0ffff8000, %%eax;" | |
| "jg .ss16xr_set;" | |
| "mov $0x8001, %%ax;" | |
| ".ss16xr_set:" | |
| "movw %%ax, (%%rcx);" | |
| "leal 8(%%rdx), %%edx;" | |
| "decl %%ebx;" | |
| "leal 4(%%rcx), %%ecx;" | |
| "jne .ss16x_lp;" | |
| ".ss16x_ed:" | |
| : /* output */ | |
| : "m" (dst), "m" (src), "m" (size) | |
| : "ebx"); | |
| } | |
| void PARTSCALL | |
| saturation_s16mmx(SINT16 *dst, const SINT32 *src, UINT size) | |
| { | |
| asm volatile ( | |
| "movq %0, %%rcx;" | |
| "movq %1, %%rdx;" | |
| "movl %2, %%eax;" | |
| "shrl $3, %%eax;" | |
| "je .ss16m_ed;" | |
| "pxor %%mm0, %%mm0;" | |
| ".ss16m_lp:" | |
| "movq (%%rdx), %%mm1;" | |
| "movq 8(%%rdx), %%mm2;" | |
| "packssdw %%mm2, %%mm1;" | |
| "leaq 16(%%rdx), %%rdx;" | |
| "movq %%mm1, (%%rcx);" | |
| "leaq 8(%%rcx), %%rcx;" | |
| "dec %%eax;" | |
| "jne .ss16m_lp;" | |
| "emms;" | |
| ".ss16m_ed:" | |
| : /* output */ | |
| : "m" (dst), "m" (src), "m" (size)); | |
| } | |
| #elif defined(GCC_CPU_ARCH_IA32) | |
| void PARTSCALL | void PARTSCALL |
| _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size) | _saturation_s16(SINT16 *dst, const SINT32 *src, UINT size) |
| { | { |
| Line 746 saturation_s16mmx(SINT16 *dst, const SIN | Line 854 saturation_s16mmx(SINT16 *dst, const SIN |
| : /* output */ | : /* output */ |
| : "m" (dst), "m" (src), "m" (size)); | : "m" (dst), "m" (src), "m" (size)); |
| } | } |
| #endif /* __GNUC__ && (i386 || __i386__) */ | #endif /* GCC_CPU_ARCH_AMD64 */ |
| #endif /* !NOSOUND */ | #endif /* !NOSOUND */ |