00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef AVUTIL_X86_INTREADWRITE_H
00022 #define AVUTIL_X86_INTREADWRITE_H
00023 
00024 #include <stdint.h>
00025 #include "config.h"
00026 #include "libavutil/attributes.h"
00027 
00028 #if HAVE_MMX
00029 
00030 #if !HAVE_FAST_64BIT && defined(__MMX__)
00031 
00032 #define AV_COPY64 AV_COPY64
00033 static av_always_inline void AV_COPY64(void *d, const void *s)
00034 {
00035     __asm__("movq   %1, %%mm0  \n\t"
00036             "movq   %%mm0, %0  \n\t"
00037             : "=m"(*(uint64_t*)d)
00038             : "m" (*(const uint64_t*)s)
00039             : "mm0");
00040 }
00041 
00042 #define AV_SWAP64 AV_SWAP64
00043 static av_always_inline void AV_SWAP64(void *a, void *b)
00044 {
00045     __asm__("movq   %1, %%mm0  \n\t"
00046             "movq   %0, %%mm1  \n\t"
00047             "movq   %%mm0, %0  \n\t"
00048             "movq   %%mm1, %1  \n\t"
00049             : "+m"(*(uint64_t*)a), "+m"(*(uint64_t*)b)
00050             ::"mm0", "mm1");
00051 }
00052 
00053 #define AV_ZERO64 AV_ZERO64
00054 static av_always_inline void AV_ZERO64(void *d)
00055 {
00056     __asm__("pxor %%mm0, %%mm0  \n\t"
00057             "movq %%mm0, %0     \n\t"
00058             : "=m"(*(uint64_t*)d)
00059             :: "mm0");
00060 }
00061 
00062 #endif 
00063 
00064 #ifdef __SSE__
00065 
00066 #define AV_COPY128 AV_COPY128
00067 static av_always_inline void AV_COPY128(void *d, const void *s)
00068 {
00069     struct v {uint64_t v[2];};
00070 
00071     __asm__("movaps   %1, %%xmm0  \n\t"
00072             "movaps   %%xmm0, %0  \n\t"
00073             : "=m"(*(struct v*)d)
00074             : "m" (*(const struct v*)s)
00075             : "xmm0");
00076 }
00077 
00078 #endif 
00079 
00080 #ifdef __SSE2__
00081 
00082 #define AV_ZERO128 AV_ZERO128
00083 static av_always_inline void AV_ZERO128(void *d)
00084 {
00085     struct v {uint64_t v[2];};
00086 
00087     __asm__("pxor %%xmm0, %%xmm0  \n\t"
00088             "movdqa   %%xmm0, %0  \n\t"
00089             : "=m"(*(struct v*)d)
00090             :: "xmm0");
00091 }
00092 
00093 #endif 
00094 
00095 #endif 
00096 
00097 #endif