Mercurial > libavcodec.hg
annotate ppc/gcc_fixes.h @ 1391:fd48c92213ae libavcodec
namespace fix (triggered by gcc-alivec-bugfix + gentoo or so) by (Magnus Damm <damm at opensource dot se>)
author | michaelni |
---|---|
date | Tue, 29 Jul 2003 10:26:34 +0000 |
parents | 09b8fe0f0139 |
children | b370288f004d |
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 |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
15 #define AVV(x...) (x) |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
16 #else |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
17 #define AVV(x...) {x} |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
18 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303) |
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 /* 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
|
21 * 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
|
22 * thanks to lu_zero for the workaround. |
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 * See this mail for more information: |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
25 * 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
|
26 */ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
27 |
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
|
28 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
|
29 vector signed char const B) |
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 static const vector unsigned char lowbyte = { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
32 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
|
33 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
|
34 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
35 return vec_perm (A, B, lowbyte); |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
36 } |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
37 |
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
|
38 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
|
39 vector signed short const B) |
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 static const vector unsigned char lowhalf = { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
42 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
|
43 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
|
44 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
45 return vec_perm (A, B, lowhalf); |
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 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
|
49 vector signed int const B) |
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 lowword = { |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
52 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
|
53 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
|
54 }; |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
55 return vec_perm (A, B, lowword); |
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 /*#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
|
58 #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
|
59 #define ff_vmrglw ff_vmrglw |
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 #undef vec_mergel |
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 #define vec_mergel(a1, a2) \ |
f3152eb76f1a
altivec gcc-3 fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
diff
changeset
|
64 __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
|
65 ((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
|
66 __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
|
67 ((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
|
68 __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
|
69 ((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
|
70 __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
|
71 ((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
|
72 __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
|
73 ((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
|
74 __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
|
75 ((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
|
76 __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
|
77 ((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
|
78 __altivec_link_error_invalid_argument ()))))))) |
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 #endif |
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 #endif /* CONFIG_DARWIN */ |
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 /* _GCC_FIXES_ */ |