summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-13 20:31:17 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-13 20:31:17 +0100
commit170812755e0ac235ed2b7182ef637eb317d8b2b2 (patch)
tree2afd0d87f0f09a8cde5f8005e8f66b6b43e03113 /src/pulsecore
parent540ec7b961256d6c7702448ca995f61268064190 (diff)
cpu: check for CMOV flag before using this intsruction in assembly
http://pulseaudio.org/ticket/776
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/cpu-x86.c6
-rw-r--r--src/pulsecore/cpu-x86.h6
-rw-r--r--src/pulsecore/svolume_mmx.c2
3 files changed, 9 insertions, 5 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 b40eb5ce..285c2031 100644
--- a/src/pulsecore/cpu-x86.h
+++ b/src/pulsecore/cpu-x86.h
@@ -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"
diff --git a/src/pulsecore/svolume_mmx.c b/src/pulsecore/svolume_mmx.c
index 46923ed3..e50ebee8 100644
--- a/src/pulsecore/svolume_mmx.c
+++ b/src/pulsecore/svolume_mmx.c
@@ -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);