Mercurial > libavcodec.hg
annotate ppc/gcc_fixes.h @ 2070:5914c2b0760f libavcodec
make ffmpeg/libavcodec/liba52/crc.c compile on systems where no inttypes.h patch by (Chip <szarlada at freemail dot hu>)
author | michael |
---|---|
date | Wed, 09 Jun 2004 01:57:47 +0000 |
parents | b370288f004d |
children | ef2149182f1c |
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. |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
3 * Used to workaround broken gcc (FSF gcc-3 pre gcc-3.3) |
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. |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
5 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
6 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
7 #ifndef _GCC_FIXES_ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
8 #define _GCC_FIXES_ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
9 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
10 #ifdef HAVE_ALTIVEC_H |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
11 #include <altivec.h> |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
12 #endif |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
13 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
14 #ifdef CONFIG_DARWIN |
1839
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
15 # ifndef __MWERKS__ |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
16 # define AVV(x...) (x) |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
17 # else |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
18 # define AVV |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
19 # endif |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
20 #else |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
21 #define AVV(x...) {x} |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
22 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303) |
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 /* 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
|
25 * 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
|
26 * thanks to lu_zero for the workaround. |
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 * See this mail for more information: |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
29 * 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
|
30 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
31 |
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
|
32 static inline vector signed char ff_vmrglb (vector signed char const A, |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
33 vector signed char const B) |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
34 { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
35 static const vector unsigned char lowbyte = { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
36 0x08, 0x18, 0x09, 0x19, 0x0a, 0x1a, 0x0b, 0x1b, |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
37 0x0c, 0x1c, 0x0d, 0x1d, 0x0e, 0x1e, 0x0f, 0x1f |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
38 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
39 return vec_perm (A, B, lowbyte); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
40 } |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
41 |
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
|
42 static inline vector signed short ff_vmrglh (vector signed short const A, |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
43 vector signed short const B) |
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 static const vector unsigned char lowhalf = { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
46 0x08, 0x09, 0x18, 0x19, 0x0a, 0x0b, 0x1a, 0x1b, |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
47 0x0c, 0x0d, 0x1c, 0x1d, 0x0e, 0x0f, 0x1e, 0x1f |
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 return vec_perm (A, B, lowhalf); |
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 |
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
|
52 static inline vector signed int ff_vmrglw (vector signed int const A, |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
53 vector signed int const B) |
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 static const vector unsigned char lowword = { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
56 0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b, |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
57 0x0c, 0x0d, 0x0e, 0x0f, 0x1c, 0x1d, 0x1e, 0x1f |
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 return vec_perm (A, B, lowword); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
60 } |
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
|
61 /*#define ff_vmrglb ff_vmrglb |
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
62 #define ff_vmrglh ff_vmrglh |
fd48c92213ae
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1340
diff
changeset
|
63 #define ff_vmrglw ff_vmrglw |
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 #undef vec_mergel |
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 #define vec_mergel(a1, a2) \ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
68 __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
|
69 ((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
|
70 __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
|
71 ((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
|
72 __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
|
73 ((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
|
74 __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
|
75 ((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
|
76 __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
|
77 ((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
|
78 __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
|
79 ((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
|
80 __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
|
81 ((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
|
82 __altivec_link_error_invalid_argument ()))))))) |
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 #endif |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
85 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
86 #endif /* CONFIG_DARWIN */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
87 |
1839
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
88 #ifndef __MWERKS__ |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
89 #define const_vector const vector |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
90 #else |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
91 #define const_vector vector |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
92 #endif |
b370288f004d
Metrowerks CodeWarrior patches by (John Dalgliesh <johnd at defyne dot org>)
michael
parents:
1391
diff
changeset
|
93 |
1277
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
94 #endif /* _GCC_FIXES_ */ |