cpu: check for CMOV flag before using this intsruction in assembly

http://pulseaudio.org/ticket/776
This commit is contained in:
Lennart Poettering 2010-01-13 20:31:17 +01:00
parent 540ec7b961
commit 170812755e
3 changed files with 9 additions and 5 deletions

View file

@ -57,6 +57,9 @@ void pa_cpu_init_x86 (void) {
if (level >= 1) {
get_cpuid (0x00000001, &eax, &ebx, &ecx, &edx);
if (edx & (1<<15))
flags |= PA_CPU_X86_CMOV;
if (edx & (1<<23))
flags |= PA_CPU_X86_MMX;
@ -97,7 +100,8 @@ void pa_cpu_init_x86 (void) {
flags |= PA_CPU_X86_3DNOW;
}
pa_log_info ("CPU flags: %s%s%s%s%s%s%s%s%s%s",
pa_log_info ("CPU flags: %s%s%s%s%s%s%s%s%s%s%s",
(flags & PA_CPU_X86_CMOV) ? "CMOV " : "",
(flags & PA_CPU_X86_MMX) ? "MMX " : "",
(flags & PA_CPU_X86_SSE) ? "SSE " : "",
(flags & PA_CPU_X86_SSE2) ? "SSE2 " : "",

View file

@ -5,7 +5,7 @@
This file is part of PulseAudio.
Copyright 2004-2006 Lennart Poettering
Copyright 2009 Wim Taymans <wim.taymans@collabora.co.uk>
Copyright 2009 Wim Taymans <wim.taymans@collabora.co.uk>
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@ -35,12 +35,12 @@ typedef enum pa_cpu_x86_flag {
PA_CPU_X86_SSE4_1 = (1 << 6),
PA_CPU_X86_SSE4_2 = (1 << 7),
PA_CPU_X86_3DNOW = (1 << 8),
PA_CPU_X86_3DNOWEXT = (1 << 9)
PA_CPU_X86_3DNOWEXT = (1 << 9),
PA_CPU_X86_CMOV = (1 << 10)
} pa_cpu_x86_flag_t;
void pa_cpu_init_x86 (void);
#if defined (__i386__)
typedef int32_t pa_reg_x86;
#define PA_REG_a "eax"

View file

@ -305,7 +305,7 @@ void pa_volume_func_init_mmx (pa_cpu_x86_flag_t flags) {
run_test ();
#endif
if (flags & PA_CPU_X86_MMX) {
if ((flags & PA_CPU_X86_MMX) && (flags & PA_CPU_X86_CMOV)) {
pa_log_info("Initialising MMX optimized functions.");
pa_set_volume_func (PA_SAMPLE_S16NE, (pa_do_volume_func_t) pa_volume_s16ne_mmx);