Mercurial > libavcodec.hg
annotate ppc/gcc_fixes.h @ 3829:e8e340cbc7f2 libavcodec
Original Commit: r23 | ods15 | 2006-09-22 13:55:48 +0300 (Fri, 22 Sep 2006) | 2 lines
mapping generation
author | ods15 |
---|---|
date | Mon, 02 Oct 2006 05:55:57 +0000 |
parents | c537a97eec66 |
children | c8c591fe26f8 |
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 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
6 * This library is free software; you can redistribute it and/or |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
7 * 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
|
8 * License as published by the Free Software Foundation; either |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
9 * version 2 of the License, or (at your option) any later version. |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
10 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
12 * 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
|
13 * 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
|
14 * 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
|
15 * |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
17 * License along with this library; if not, write to the Free Software |
c537a97eec66
Add official LGPL license headers to the files that were missing them.
diego
parents:
3264
diff
changeset
|
18 * 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
|
19 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
20 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
21 #ifndef _GCC_FIXES_ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
22 #define _GCC_FIXES_ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
23 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
24 #ifdef HAVE_ALTIVEC_H |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
25 #include <altivec.h> |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
26 #endif |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
27 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
28 #ifdef CONFIG_DARWIN |
1839
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
29 # ifndef __MWERKS__ |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
30 # define AVV(x...) (x) |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
31 # else |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
32 # define AVV |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
33 # endif |
3252 | 34 #define REG_v(a) asm ( #a ) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
35 #else |
3252 | 36 |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
37 #define AVV(x...) {x} |
3252 | 38 |
39 #if (__GNUC__ < 4) | |
3264 | 40 # define REG_v(a) |
3252 | 41 #else |
3264 | 42 # define REG_v(a) asm ( #a ) |
3252 | 43 #endif |
44 | |
2967 | 45 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303) |
1277
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 /* 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
|
48 * 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
|
49 * thanks to lu_zero for the workaround. |
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 * See this mail for more information: |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
52 * 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
|
53 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
54 |
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
|
55 static inline vector signed char ff_vmrglb (vector signed char const A, |
2979 | 56 vector signed char const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
57 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
58 static const vector unsigned char lowbyte = { |
2979 | 59 0x08, 0x18, 0x09, 0x19, 0x0a, 0x1a, 0x0b, 0x1b, |
60 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
|
61 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
62 return vec_perm (A, B, lowbyte); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
63 } |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
64 |
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
|
65 static inline vector signed short ff_vmrglh (vector signed short const A, |
2979 | 66 vector signed short const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
67 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
68 static const vector unsigned char lowhalf = { |
2979 | 69 0x08, 0x09, 0x18, 0x19, 0x0a, 0x0b, 0x1a, 0x1b, |
70 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
|
71 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
72 return vec_perm (A, B, lowhalf); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
73 } |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
74 |
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
|
75 static inline vector signed int ff_vmrglw (vector signed int const A, |
2979 | 76 vector signed int const B) |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
77 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
78 static const vector unsigned char lowword = { |
2979 | 79 0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b, |
80 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
|
81 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
82 return vec_perm (A, B, lowword); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
83 } |
2967 | 84 /*#define ff_vmrglb ff_vmrglb |
85 #define ff_vmrglh ff_vmrglh | |
86 #define ff_vmrglw ff_vmrglw | |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
87 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
88 #undef vec_mergel |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
89 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
90 #define vec_mergel(a1, a2) \ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
91 __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
|
92 ((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
|
93 __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
|
94 ((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
|
95 __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
|
96 ((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
|
97 __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
|
98 ((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
|
99 __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
|
100 ((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
|
101 __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
|
102 ((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
|
103 __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
|
104 ((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
|
105 __altivec_link_error_invalid_argument ()))))))) |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
106 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
107 #endif |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
108 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
109 #endif /* CONFIG_DARWIN */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
110 |
1839
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
111 #ifndef __MWERKS__ |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
112 #define const_vector const vector |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
113 #else |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
114 #define const_vector vector |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
115 #endif |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
116 |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
117 #endif /* _GCC_FIXES_ */ |