fix mmx more

SVN revision: 22500
This commit is contained in:
Carsten Haitzler 2006-05-10 04:06:42 +00:00
parent 5ff7329f93
commit 646e3a1e3c
1 changed files with 43 additions and 2 deletions

View File

@ -121,11 +121,11 @@ typedef union {
#define mmx_a2r(op, mem, reg) \
__asm__ __volatile__ (#op " %0, %%" #reg \
: /* nothing */ \
: "g" (mem))
: "m" (mem))
#define mmx_r2a(op, reg, mem) \
__asm__ __volatile__ (#op " %%" #reg ", %0" \
: "=g" (mem) \
: "=m" (mem) \
: /* nothing */ )
#define mmx_r2r(op, regs, regd) \
@ -582,6 +582,46 @@ typedef union {
#define CPUID_SSE (1 << 25) /* flags: xmm */
#define CPUID_SSE2 (1 << 26) /* flags: ? */
#ifdef __amd64
#define have_cpuid(cpuid_ret) \
__asm__ __volatile__ ( \
".align 32 \n" \
" pushq %%rbx \n" \
" pushfq \n" \
" popq %%rax \n" \
" movq %%rax, %%rbx \n" \
" xorq $0x200000, %%rax \n" \
" pushq %%rax \n" \
" popfq \n" \
" pushfq \n" \
" popq %%rax \n" \
" cmpq %%rax, %%rbx \n" \
" je 1f \n" \
" movl $1, %0 \n" \
" jmp 2f \n" \
"1: \n" \
" movl $0, %0 \n" \
"2: \n" \
" popq %%rbx \n" \
: "=m" (cpuid_ret) \
);
#define get_cpuid(cpuid_ret) \
__asm__ __volatile__ ( \
".align 32 \n" \
" pushq %%rax \n" \
" movl $1, %%eax \n" \
" cpuid \n" \
" test $0x00800000, %%edx\n" \
"1: \n" \
" movl %%edx, %0 \n" \
" jmp 2f \n" \
"2: \n" \
" movl $0, %0 \n" \
" popq %%rax \n" \
: "=m" (cpuid_ret) \
);
#else
#define have_cpuid(cpuid_ret) \
__asm__ __volatile__ ( \
".align 32 \n" \
@ -620,6 +660,7 @@ typedef union {
" popl %%eax \n" \
: "=m" (cpuid_ret) \
);
#endif
#define prefetch(var) \
__asm__ __volatile__ ( \
"prefetchnta (%0) \n" \