aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/i386/cputest.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2004-10-11 02:19:29 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-10-11 02:19:29 +0000
commit053dea12f27e6bb8acf6a103ef954da05419d3dc (patch)
treea23d86aee2e3ab3c9ad72a6fa1e4882ebd0b1228 /libavcodec/i386/cputest.c
parent3ba1438dec553ab106aac8895ddebc01e42c5b71 (diff)
downloadffmpeg-053dea12f27e6bb8acf6a103ef954da05419d3dc.tar.gz
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
Originally committed as revision 3578 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386/cputest.c')
-rw-r--r--libavcodec/i386/cputest.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/i386/cputest.c b/libavcodec/i386/cputest.c
index 34b813148c..9b2e6a2ce9 100644
--- a/libavcodec/i386/cputest.c
+++ b/libavcodec/i386/cputest.c
@@ -4,12 +4,20 @@
#include <stdlib.h>
#include "../dsputil.h"
+#ifdef ARCH_X86_64
+# define REG_b "rbx"
+# define REG_S "rsi"
+#else
+# define REG_b "ebx"
+# define REG_S "esi"
+#endif
+
/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
#define cpuid(index,eax,ebx,ecx,edx)\
__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" (eax), "=S" (ebx),\
"=c" (ecx), "=d" (edx)\
: "0" (index));
@@ -24,7 +32,7 @@ int mm_support(void)
/* See if CPUID instruction is supported ... */
/* ... Get copies of EFLAGS into eax and ecx */
"pushf\n\t"
- "popl %0\n\t"
+ "pop %0\n\t"
"movl %0, %1\n\t"
/* ... Toggle the ID bit in one copy and store */
@@ -35,7 +43,7 @@ int mm_support(void)
/* ... Get the (hopefully modified) EFLAGS */
"pushf\n\t"
- "popl %0\n\t"
+ "pop %0\n\t"
: "=a" (eax), "=c" (ecx)
:
: "cc"