Mercurial > libavutil.hg
annotate x86/intreadwrite.h @ 854:d6d589d11549 libavutil
Fix build failure with fast_unaligned and non-gcc-compatible compilers
author | mru |
---|---|
date | Tue, 02 Mar 2010 03:16:24 +0000 |
parents | 7c4f89909560 |
children | 434a611c1e54 |
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" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
26 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
27 #if HAVE_MMX |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
28 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
29 #if !HAVE_FAST_64BIT && defined(__MMX__) |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
30 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
31 #define AV_COPY64 AV_COPY64 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
32 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
|
33 { |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
34 __asm__("movq %1, %%mm0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
35 "movq %%mm0, %0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
36 : "=m"(*(uint64_t*)d) |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
37 : "m" (*(const uint64_t*)s) |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
38 : "mm0"); |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
39 } |
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 #define AV_SWAP64 AV_SWAP64 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
42 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
|
43 { |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
44 __asm__("movq %1, %%mm0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
45 "movq %0, %%mm1 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
46 "movq %%mm0, %0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
47 "movq %%mm1, %1 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
48 : "+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
|
49 ::"mm0", "mm1"); |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
50 } |
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 #define AV_ZERO64 AV_ZERO64 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
53 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
|
54 { |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
55 __asm__("pxor %%mm0, %%mm0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
56 "movq %%mm0, %0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
57 : "=m"(*(uint64_t*)d) |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
58 :: "mm0"); |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
59 } |
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 #endif /* !HAVE_FAST_64BIT && defined(__MMX__) */ |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
62 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
63 #ifdef __SSE__ |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
64 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
65 #define AV_COPY128 AV_COPY128 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
66 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
|
67 { |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
68 struct v {uint64_t v[2];}; |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
69 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
70 __asm__("movaps %1, %%xmm0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
71 "movaps %%xmm0, %0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
72 : "=m"(*(struct v*)d) |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
73 : "m" (*(const struct v*)s) |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
74 : "xmm0"); |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
75 } |
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 #endif /* __SSE__ */ |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
78 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
79 #ifdef __SSE2__ |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
80 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
81 #define AV_ZERO128 AV_ZERO128 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
82 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
|
83 { |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
84 struct v {uint64_t v[2];}; |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
85 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
86 __asm__("pxor %%xmm0, %%xmm0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
87 "movdqa %%xmm0, %0 \n\t" |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
88 : "=m"(*(struct v*)d) |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
89 :: "xmm0"); |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
90 } |
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 #endif /* __SSE2__ */ |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
93 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
94 #endif /* HAVE_MMX */ |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
95 |
7c4f89909560
Add macros for 64- and 128-bit write-combining optimization to intreadwrite.h.
astrange
parents:
diff
changeset
|
96 #endif /* AVUTIL_X86_INTREADWRITE_H */ |