summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-13 20:31:17 +0100
committerColin Guthrie <cguthrie@mandriva.org>2010-02-09 22:32:39 +0000
commit54025c96a7133964aa1568fe6d2e6c5ad05651bf (patch)
treea5f6552814d0394b25993b3eec9f34abf296cb90 /src
parentc88e4680f050a6ac65335b1d8148287cc4566b00 (diff)
cpu: check for CMOV flag before using this intsruction in assembly
http://pulseaudio.org/ticket/776
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/cpu-x86.c6
-rw-r--r--src/pulsecore/cpu-x86.h4
-rw-r--r--src/pulsecore/svolume_mmx.c2
3 files changed, 8 insertions, 4 deletions
diff --git a/src/pulsecore/cpu-x86.c b/src/pulsecore/cpu-x86.c
index f194a608..b1730722 100644
--- a/src/pulsecore/cpu-x86.c
+++ b/src/pulsecore/cpu-x86.c
@@ -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 " : "",
diff --git a/src/pulsecore/cpu-x86.h b/src/pulsecore/cpu-x86.h
index f6484c59..285c2031 100644
--- a/src/pulsecore/cpu-x86.h
+++ b/src/pulsecore/cpu-x86.h
@@ -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"
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index a011789c..0e222cdc 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -309,7 +309,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);