summaryrefslogtreecommitdiffstats
path: root/cpudetect.c
diff options
context:
space:
mode:
authoraurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-10-21 11:55:20 +0000
committeraurel <aurel@b3059339-0415-0410-9bf9-f77b7e298cf2>2004-10-21 11:55:20 +0000
commit798d2d133780c000166f01fd2d7fbde395196be3 (patch)
tree1346451ddb9911c63cd778af21261a6ae6f70346 /cpudetect.c
parent159928a38a3fc65427a1336b2c73aa3f78a82aa7 (diff)
downloadmpv-798d2d133780c000166f01fd2d7fbde395196be3.tar.bz2
mpv-798d2d133780c000166f01fd2d7fbde395196be3.tar.xz
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13721 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'cpudetect.c')
-rw-r--r--cpudetect.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/cpudetect.c b/cpudetect.c
index 9e05236319..65d7e5ed6d 100644
--- a/cpudetect.c
+++ b/cpudetect.c
@@ -9,7 +9,7 @@ CpuCaps gCpuCaps;
#endif
#include <stdlib.h>
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
#include <stdio.h>
#include <string.h>
@@ -47,25 +47,25 @@ static void check_os_katmai_support( void );
// return TRUE if cpuid supported
static int has_cpuid()
{
- int a, c;
+ long a, c;
// code from libavcodec:
__asm__ __volatile__ (
/* See if CPUID instruction is supported ... */
/* ... Get copies of EFLAGS into eax and ecx */
"pushf\n\t"
- "popl %0\n\t"
- "movl %0, %1\n\t"
+ "pop %0\n\t"
+ "mov %0, %1\n\t"
/* ... Toggle the ID bit in one copy and store */
/* to the EFLAGS reg */
- "xorl $0x200000, %0\n\t"
+ "xor $0x200000, %0\n\t"
"push %0\n\t"
"popf\n\t"
/* ... Get the (hopefully modified) EFLAGS */
"pushf\n\t"
- "popl %0\n\t"
+ "pop %0\n\t"
: "=a" (a), "=c" (c)
:
: "cc"
@@ -87,9 +87,9 @@ do_cpuid(unsigned int ax, unsigned int *p)
#else
// code from libavcodec:
__asm __volatile
- ("movl %%ebx, %%esi\n\t"
+ ("mov %%"REG_b", %%"REG_S"\n\t"
"cpuid\n\t"
- "xchgl %%ebx, %%esi"
+ "xchg %%"REG_b", %%"REG_S
: "=a" (p[0]), "=S" (p[1]),
"=c" (p[2]), "=d" (p[3])
: "0" (ax));
@@ -456,7 +456,7 @@ static void check_os_katmai_support( void )
gCpuCaps.hasSSE=0;
#endif /* __linux__ */
}
-#else /* ARCH_X86 */
+#else /* ARCH_X86 || ARCH_X86_64 */
#ifdef SYS_DARWIN
#include <sys/sysctl.h>
@@ -536,10 +536,6 @@ void GetCpuCaps( CpuCaps *caps)
mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: Intel Itanium\n");
#endif
-#ifdef ARCH_X86_64
- mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: Advanced Micro Devices 64-bit CPU\n");
-#endif
-
#ifdef ARCH_SPARC
mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: Sun Sparc\n");
#endif