diff libavutil/x86/intreadwrite.h @ 2:897f711a7157

rearrange to work with autoconf
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Tue, 25 Sep 2012 15:55:33 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libavutil/x86/intreadwrite.h	Tue Sep 25 15:55:33 2012 +0200
     1.3 @@ -0,0 +1,97 @@
     1.4 +/*
     1.5 + * Copyright (c) 2010 Alexander Strange <astrange@ithinksw.com>
     1.6 + *
     1.7 + * This file is part of FFmpeg.
     1.8 + *
     1.9 + * FFmpeg is free software; you can redistribute it and/or
    1.10 + * modify it under the terms of the GNU Lesser General Public
    1.11 + * License as published by the Free Software Foundation; either
    1.12 + * version 2.1 of the License, or (at your option) any later version.
    1.13 + *
    1.14 + * FFmpeg is distributed in the hope that it will be useful,
    1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.17 + * Lesser General Public License for more details.
    1.18 + *
    1.19 + * You should have received a copy of the GNU Lesser General Public
    1.20 + * License along with FFmpeg; if not, write to the Free Software
    1.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    1.22 + */
    1.23 +
    1.24 +#ifndef AVUTIL_X86_INTREADWRITE_H
    1.25 +#define AVUTIL_X86_INTREADWRITE_H
    1.26 +
    1.27 +#include <stdint.h>
    1.28 +#include "config.h"
    1.29 +#include "libavutil/attributes.h"
    1.30 +
    1.31 +#if HAVE_MMX
    1.32 +
    1.33 +#if defined(__MMX__)
    1.34 +
    1.35 +#define AV_COPY64 AV_COPY64
    1.36 +static av_always_inline void AV_COPY64(void *d, const void *s)
    1.37 +{
    1.38 +    __asm__("movq   %1, %%mm0  \n\t"
    1.39 +            "movq   %%mm0, %0  \n\t"
    1.40 +            : "=m"(*(uint64_t*)d)
    1.41 +            : "m" (*(const uint64_t*)s)
    1.42 +            : "mm0");
    1.43 +}
    1.44 +
    1.45 +#define AV_SWAP64 AV_SWAP64
    1.46 +static av_always_inline void AV_SWAP64(void *a, void *b)
    1.47 +{
    1.48 +    __asm__("movq   %1, %%mm0  \n\t"
    1.49 +            "movq   %0, %%mm1  \n\t"
    1.50 +            "movq   %%mm0, %0  \n\t"
    1.51 +            "movq   %%mm1, %1  \n\t"
    1.52 +            : "+m"(*(uint64_t*)a), "+m"(*(uint64_t*)b)
    1.53 +            ::"mm0", "mm1");
    1.54 +}
    1.55 +
    1.56 +#define AV_ZERO64 AV_ZERO64
    1.57 +static av_always_inline void AV_ZERO64(void *d)
    1.58 +{
    1.59 +    __asm__("pxor %%mm0, %%mm0  \n\t"
    1.60 +            "movq %%mm0, %0     \n\t"
    1.61 +            : "=m"(*(uint64_t*)d)
    1.62 +            :: "mm0");
    1.63 +}
    1.64 +
    1.65 +#endif /* !HAVE_FAST_64BIT && defined(__MMX__) */
    1.66 +
    1.67 +#ifdef __SSE__
    1.68 +
    1.69 +#define AV_COPY128 AV_COPY128
    1.70 +static av_always_inline void AV_COPY128(void *d, const void *s)
    1.71 +{
    1.72 +    struct v {uint64_t v[2];};
    1.73 +
    1.74 +    __asm__("movaps   %1, %%xmm0  \n\t"
    1.75 +            "movaps   %%xmm0, %0  \n\t"
    1.76 +            : "=m"(*(struct v*)d)
    1.77 +            : "m" (*(const struct v*)s)
    1.78 +            : "xmm0");
    1.79 +}
    1.80 +
    1.81 +#endif /* __SSE__ */
    1.82 +
    1.83 +#ifdef __SSE2__
    1.84 +
    1.85 +#define AV_ZERO128 AV_ZERO128
    1.86 +static av_always_inline void AV_ZERO128(void *d)
    1.87 +{
    1.88 +    struct v {uint64_t v[2];};
    1.89 +
    1.90 +    __asm__("pxor %%xmm0, %%xmm0  \n\t"
    1.91 +            "movdqa   %%xmm0, %0  \n\t"
    1.92 +            : "=m"(*(struct v*)d)
    1.93 +            :: "xmm0");
    1.94 +}
    1.95 +
    1.96 +#endif /* __SSE2__ */
    1.97 +
    1.98 +#endif /* HAVE_MMX */
    1.99 +
   1.100 +#endif /* AVUTIL_X86_INTREADWRITE_H */