Mercurial > libavcodec.hg
annotate ppc/gcc_fixes.h @ 5612:0ffea9729a0d libavcodec
snow altivec is broken
author | lu_zero |
---|---|
date | Tue, 28 Aug 2007 13:39:50 +0000 |
parents | 5763bfcaa388 |
children | 61768139733b |
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 |
5567 | 23 #ifndef GCC_FIXES_H |
24 #define GCC_FIXES_H | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
25 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
26 #ifdef HAVE_ALTIVEC_H |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
27 #include <altivec.h> |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
28 #endif |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
29 |
3252 | 30 #if (__GNUC__ < 4) |
3264 | 31 # define REG_v(a) |
3252 | 32 #else |
3264 | 33 # define REG_v(a) asm ( #a ) |
3252 | 34 #endif |
35 | |
2967 | 36 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
37 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
38 /* 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
|
39 * 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
|
40 * thanks to lu_zero for the workaround. |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
41 * |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
42 * See this mail for more information: |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
43 * 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
|
44 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
45 |
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
|
46 static inline vector signed char ff_vmrglb (vector signed char const A, |
2979 | 47 vector signed char const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
48 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
49 static const vector unsigned char lowbyte = { |
2979 | 50 0x08, 0x18, 0x09, 0x19, 0x0a, 0x1a, 0x0b, 0x1b, |
51 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
|
52 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
53 return vec_perm (A, B, lowbyte); |
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 |
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
|
56 static inline vector signed short ff_vmrglh (vector signed short const A, |
2979 | 57 vector signed short const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
58 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
59 static const vector unsigned char lowhalf = { |
2979 | 60 0x08, 0x09, 0x18, 0x19, 0x0a, 0x0b, 0x1a, 0x1b, |
61 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
|
62 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
63 return vec_perm (A, B, lowhalf); |
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 |
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
|
66 static inline vector signed int ff_vmrglw (vector signed int const A, |
2979 | 67 vector signed int const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
68 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
69 static const vector unsigned char lowword = { |
2979 | 70 0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b, |
71 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
|
72 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
73 return vec_perm (A, B, lowword); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
74 } |
2967 | 75 /*#define ff_vmrglb ff_vmrglb |
76 #define ff_vmrglh ff_vmrglh | |
77 #define ff_vmrglw ff_vmrglw | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
78 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
79 #undef vec_mergel |
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 #define vec_mergel(a1, a2) \ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
82 __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
|
83 ((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
|
84 __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
|
85 ((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
|
86 __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
|
87 ((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
|
88 __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
|
89 ((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
|
90 __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
|
91 ((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
|
92 __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
|
93 ((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
|
94 __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
|
95 ((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
|
96 __altivec_link_error_invalid_argument ()))))))) |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
97 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
98 #endif |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
99 |
1839
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
100 #ifndef __MWERKS__ |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
101 #define const_vector const vector |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
102 #else |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
103 #define const_vector vector |
5581 | 104 #define AVV |
1839
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
105 #endif |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
106 |
5567 | 107 #endif /* GCC_FIXES_H */ |