annotate ppc/gcc_fixes.h @ 5260:d623b3171830 libavcodec

indent
author mru
date Sun, 08 Jul 2007 23:15:12 +0000
parents c8c591fe26f8
children 35cc7c922a76
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1839
diff changeset
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
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
23 #ifndef _GCC_FIXES_
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
24 #define _GCC_FIXES_
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
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
30 #ifdef CONFIG_DARWIN
1839
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
31 # ifndef __MWERKS__
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
32 # define AVV(x...) (x)
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
33 # else
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
34 # define AVV
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
35 # endif
3252
0b482ccd7f0e hadamard8_diff* enabled on linux/ppc
lu_zero
parents: 2979
diff changeset
36 #define REG_v(a) asm ( #a )
1277
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
37 #else
3252
0b482ccd7f0e hadamard8_diff* enabled on linux/ppc
lu_zero
parents: 2979
diff changeset
38
1277
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
39 #define AVV(x...) {x}
3252
0b482ccd7f0e hadamard8_diff* enabled on linux/ppc
lu_zero
parents: 2979
diff changeset
40
0b482ccd7f0e hadamard8_diff* enabled on linux/ppc
lu_zero
parents: 2979
diff changeset
41 #if (__GNUC__ < 4)
3264
8ea7f9aaa8fd typo in the gcc handmade regalloc trigger
lu_zero
parents: 3252
diff changeset
42 # define REG_v(a)
3252
0b482ccd7f0e hadamard8_diff* enabled on linux/ppc
lu_zero
parents: 2979
diff changeset
43 #else
3264
8ea7f9aaa8fd typo in the gcc handmade regalloc trigger
lu_zero
parents: 3252
diff changeset
44 # define REG_v(a) asm ( #a )
3252
0b482ccd7f0e hadamard8_diff* enabled on linux/ppc
lu_zero
parents: 2979
diff changeset
45 #endif
0b482ccd7f0e hadamard8_diff* enabled on linux/ppc
lu_zero
parents: 2979
diff changeset
46
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1839
diff changeset
47 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
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 /* 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
50 * 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
51 * thanks to lu_zero for the workaround.
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 * See this mail for more information:
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
54 * 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
55 */
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
56
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
57 static inline vector signed char ff_vmrglb (vector signed char const A,
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
58 vector signed char const B)
1277
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
59 {
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
60 static const vector unsigned char lowbyte = {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
61 0x08, 0x18, 0x09, 0x19, 0x0a, 0x1a, 0x0b, 0x1b,
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
62 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
63 };
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
64 return vec_perm (A, B, lowbyte);
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
65 }
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
66
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
67 static inline vector signed short ff_vmrglh (vector signed short const A,
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
68 vector signed short const B)
1277
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
69 {
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
70 static const vector unsigned char lowhalf = {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
71 0x08, 0x09, 0x18, 0x19, 0x0a, 0x0b, 0x1a, 0x1b,
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
72 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
73 };
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
74 return vec_perm (A, B, lowhalf);
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
75 }
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
76
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
77 static inline vector signed int ff_vmrglw (vector signed int const A,
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
78 vector signed int const B)
1277
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
79 {
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
80 static const vector unsigned char lowword = {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
81 0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b,
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
82 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
83 };
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
84 return vec_perm (A, B, lowword);
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
85 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1839
diff changeset
86 /*#define ff_vmrglb ff_vmrglb
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1839
diff changeset
87 #define ff_vmrglh ff_vmrglh
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1839
diff changeset
88 #define ff_vmrglw ff_vmrglw
1277
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 #undef vec_mergel
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
91
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
92 #define vec_mergel(a1, a2) \
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
93 __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
94 ((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
95 __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
96 ((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
97 __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
98 ((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
99 __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
100 ((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
101 __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
102 ((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
103 __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
104 ((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
105 __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
106 ((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
107 __altivec_link_error_invalid_argument ())))))))
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
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
110
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
111 #endif /* CONFIG_DARWIN */
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
112
1839
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
113 #ifndef __MWERKS__
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
114 #define const_vector const vector
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
115 #else
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
116 #define const_vector vector
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
117 #endif
b370288f004d Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents: 1391
diff changeset
118
1277
f3152eb76f1a altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff changeset
119 #endif /* _GCC_FIXES_ */