Mercurial > libavcodec.hg
annotate ppc/gcc_fixes.h @ 6515:f44ffc9a68c8 libavcodec
british_english--;
author | diego |
---|---|
date | Thu, 20 Mar 2008 19:08:42 +0000 |
parents | 10e8a0596311 |
children | c4a4495715dd |
rev | line source |
---|---|
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
1 /* |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
2 * gcc fixes for altivec. |
2967 | 3 * Used to workaround broken gcc (FSF gcc-3 pre gcc-3.3) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
4 * and to stay somewhat compatible with Darwin. |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
5 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
6 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
7 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
12 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
16 * Lesser General Public License for more details. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
17 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3699
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3699
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
21 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
22 |
5830
1d83e9c34641
Add FFMPEG_ prefix to all multiple inclusion guards.
diego
parents:
5746
diff
changeset
|
23 #ifndef FFMPEG_GCC_FIXES_H |
1d83e9c34641
Add FFMPEG_ prefix to all multiple inclusion guards.
diego
parents:
5746
diff
changeset
|
24 #define FFMPEG_GCC_FIXES_H |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
25 |
6078 | 26 #include "config.h" |
27 | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
28 #ifdef HAVE_ALTIVEC_H |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
29 #include <altivec.h> |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
30 #endif |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
31 |
3252 | 32 #if (__GNUC__ < 4) |
3264 | 33 # define REG_v(a) |
3252 | 34 #else |
3264 | 35 # define REG_v(a) asm ( #a ) |
3252 | 36 #endif |
37 | |
6154
10e8a0596311
Simplify preprocessor expression as suggested by Mans.
diego
parents:
6143
diff
changeset
|
38 #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
39 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
40 /* This code was provided to me by Bartosch Pixa |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
41 * as a separate header file (broken_mergel.h). |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
42 * thanks to lu_zero for the workaround. |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
43 * |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
44 * See this mail for more information: |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
45 * http://gcc.gnu.org/ml/gcc/2003-04/msg00967.html |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
46 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
47 |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
48 static inline vector signed char ff_vmrglb (vector signed char const A, |
2979 | 49 vector signed char const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
50 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
51 static const vector unsigned char lowbyte = { |
2979 | 52 0x08, 0x18, 0x09, 0x19, 0x0a, 0x1a, 0x0b, 0x1b, |
53 0x0c, 0x1c, 0x0d, 0x1d, 0x0e, 0x1e, 0x0f, 0x1f | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
54 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
55 return vec_perm (A, B, lowbyte); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
56 } |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
57 |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
58 static inline vector signed short ff_vmrglh (vector signed short const A, |
2979 | 59 vector signed short const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
60 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
61 static const vector unsigned char lowhalf = { |
2979 | 62 0x08, 0x09, 0x18, 0x19, 0x0a, 0x0b, 0x1a, 0x1b, |
63 0x0c, 0x0d, 0x1c, 0x1d, 0x0e, 0x0f, 0x1e, 0x1f | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
64 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
65 return vec_perm (A, B, lowhalf); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
66 } |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
67 |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
68 static inline vector signed int ff_vmrglw (vector signed int const A, |
2979 | 69 vector signed int const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
70 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
71 static const vector unsigned char lowword = { |
2979 | 72 0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b, |
73 0x0c, 0x0d, 0x0e, 0x0f, 0x1c, 0x1d, 0x1e, 0x1f | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
74 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
75 return vec_perm (A, B, lowword); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
76 } |
2967 | 77 /*#define ff_vmrglb ff_vmrglb |
78 #define ff_vmrglh ff_vmrglh | |
79 #define ff_vmrglw ff_vmrglw | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
80 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
81 #undef vec_mergel |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
82 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
83 #define vec_mergel(a1, a2) \ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
84 __ch (__bin_args_eq (vector signed char, (a1), vector signed char, (a2)), \ |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
85 ((vector signed char) ff_vmrglb ((vector signed char) (a1), (vector signed char) (a2))), \ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
86 __ch (__bin_args_eq (vector unsigned char, (a1), vector unsigned char, (a2)), \ |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
87 ((vector unsigned char) ff_vmrglb ((vector signed char) (a1), (vector signed char) (a2))), \ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
88 __ch (__bin_args_eq (vector signed short, (a1), vector signed short, (a2)), \ |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
89 ((vector signed short) ff_vmrglh ((vector signed short) (a1), (vector signed short) (a2))), \ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
90 __ch (__bin_args_eq (vector unsigned short, (a1), vector unsigned short, (a2)), \ |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
91 ((vector unsigned short) ff_vmrglh ((vector signed short) (a1), (vector signed short) (a2))), \ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
92 __ch (__bin_args_eq (vector float, (a1), vector float, (a2)), \ |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
93 ((vector float) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
94 __ch (__bin_args_eq (vector signed int, (a1), vector signed int, (a2)), \ |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
95 ((vector signed int) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
96 __ch (__bin_args_eq (vector unsigned int, (a1), vector unsigned int, (a2)), \ |
1391
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
97 ((vector unsigned int) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
98 __altivec_link_error_invalid_argument ()))))))) |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
99 |
6154
10e8a0596311
Simplify preprocessor expression as suggested by Mans.
diego
parents:
6143
diff
changeset
|
100 #endif /* (__GNUC__ == 3 && __GNUC_MINOR__ < 3) */ |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
101 |
5830
1d83e9c34641
Add FFMPEG_ prefix to all multiple inclusion guards.
diego
parents:
5746
diff
changeset
|
102 #endif /* FFMPEG_GCC_FIXES_H */ |