annotate x86/intreadwrite.h @ 1028:5dbb12a37c3d libavutil tip

Move av_set_options_string() from libavfilter to libavutil.
author stefano
date Mon, 27 Sep 2010 22:09:53 +0000
parents 4d9ad0ed07d0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
813
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
1 /*
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
2 * Copyright (c) 2010 Alexander Strange <astrange@ithinksw.com>
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
3 *
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
4 * This file is part of FFmpeg.
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
5 *
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
10 *
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
14 * Lesser General Public License for more details.
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
15 *
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
19 */
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
20
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
21 #ifndef AVUTIL_X86_INTREADWRITE_H
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
22 #define AVUTIL_X86_INTREADWRITE_H
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
23
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
24 #include <stdint.h>
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
25 #include "config.h"
873
4d9ad0ed07d0 Replace many includes of libavutil/common.h with what is actually needed
mru
parents: 862
diff changeset
26 #include "libavutil/attributes.h"
813
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
27
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
28 #if HAVE_MMX
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
29
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
30 #if !HAVE_FAST_64BIT && defined(__MMX__)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
31
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
32 #define AV_COPY64 AV_COPY64
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
33 static av_always_inline void AV_COPY64(void *d, const void *s)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
34 {
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
35 __asm__("movq %1, %%mm0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
36 "movq %%mm0, %0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
37 : "=m"(*(uint64_t*)d)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
38 : "m" (*(const uint64_t*)s)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
39 : "mm0");
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
40 }
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
41
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
42 #define AV_SWAP64 AV_SWAP64
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
43 static av_always_inline void AV_SWAP64(void *a, void *b)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
44 {
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
45 __asm__("movq %1, %%mm0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
46 "movq %0, %%mm1 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
47 "movq %%mm0, %0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
48 "movq %%mm1, %1 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
49 : "+m"(*(uint64_t*)a), "+m"(*(uint64_t*)b)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
50 ::"mm0", "mm1");
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
51 }
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
52
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
53 #define AV_ZERO64 AV_ZERO64
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
54 static av_always_inline void AV_ZERO64(void *d)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
55 {
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
56 __asm__("pxor %%mm0, %%mm0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
57 "movq %%mm0, %0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
58 : "=m"(*(uint64_t*)d)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
59 :: "mm0");
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
60 }
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
61
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
62 #endif /* !HAVE_FAST_64BIT && defined(__MMX__) */
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
63
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
64 #ifdef __SSE__
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
65
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
66 #define AV_COPY128 AV_COPY128
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
67 static av_always_inline void AV_COPY128(void *d, const void *s)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
68 {
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
69 struct v {uint64_t v[2];};
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
70
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
71 __asm__("movaps %1, %%xmm0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
72 "movaps %%xmm0, %0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
73 : "=m"(*(struct v*)d)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
74 : "m" (*(const struct v*)s)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
75 : "xmm0");
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
76 }
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
77
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
78 #endif /* __SSE__ */
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
79
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
80 #ifdef __SSE2__
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
81
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
82 #define AV_ZERO128 AV_ZERO128
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
83 static av_always_inline void AV_ZERO128(void *d)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
84 {
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
85 struct v {uint64_t v[2];};
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
86
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
87 __asm__("pxor %%xmm0, %%xmm0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
88 "movdqa %%xmm0, %0 \n\t"
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
89 : "=m"(*(struct v*)d)
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
90 :: "xmm0");
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
91 }
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
92
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
93 #endif /* __SSE2__ */
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
94
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
95 #endif /* HAVE_MMX */
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
96
7c4f89909560 Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff changeset
97 #endif /* AVUTIL_X86_INTREADWRITE_H */