00001
00002
00003
00004
00005
00006
00007 #ifndef _GCC_FIXES_
00008 #define _GCC_FIXES_
00009
00010 #ifdef HAVE_ALTIVEC_H
00011 #include <altivec.h>
00012 #endif
00013
00014 #ifdef CONFIG_DARWIN
00015 # ifndef __MWERKS__
00016 # define AVV(x...) (x)
00017 # else
00018 # define AVV
00019 # endif
00020 #else
00021 #define AVV(x...) {x}
00022 #if (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 static inline vector signed char ff_vmrglb (vector signed char const A,
00033 vector signed char const B)
00034 {
00035 static const vector unsigned char lowbyte = {
00036 0x08, 0x18, 0x09, 0x19, 0x0a, 0x1a, 0x0b, 0x1b,
00037 0x0c, 0x1c, 0x0d, 0x1d, 0x0e, 0x1e, 0x0f, 0x1f
00038 };
00039 return vec_perm (A, B, lowbyte);
00040 }
00041
00042 static inline vector signed short ff_vmrglh (vector signed short const A,
00043 vector signed short const B)
00044 {
00045 static const vector unsigned char lowhalf = {
00046 0x08, 0x09, 0x18, 0x19, 0x0a, 0x0b, 0x1a, 0x1b,
00047 0x0c, 0x0d, 0x1c, 0x1d, 0x0e, 0x0f, 0x1e, 0x1f
00048 };
00049 return vec_perm (A, B, lowhalf);
00050 }
00051
00052 static inline vector signed int ff_vmrglw (vector signed int const A,
00053 vector signed int const B)
00054 {
00055 static const vector unsigned char lowword = {
00056 0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b,
00057 0x0c, 0x0d, 0x0e, 0x0f, 0x1c, 0x1d, 0x1e, 0x1f
00058 };
00059 return vec_perm (A, B, lowword);
00060 }
00061
00062
00063
00064
00065 #undef vec_mergel
00066
00067 #define vec_mergel(a1, a2) \
00068 __ch (__bin_args_eq (vector signed char, (a1), vector signed char, (a2)), \
00069 ((vector signed char) ff_vmrglb ((vector signed char) (a1), (vector signed char) (a2))), \
00070 __ch (__bin_args_eq (vector unsigned char, (a1), vector unsigned char, (a2)), \
00071 ((vector unsigned char) ff_vmrglb ((vector signed char) (a1), (vector signed char) (a2))), \
00072 __ch (__bin_args_eq (vector signed short, (a1), vector signed short, (a2)), \
00073 ((vector signed short) ff_vmrglh ((vector signed short) (a1), (vector signed short) (a2))), \
00074 __ch (__bin_args_eq (vector unsigned short, (a1), vector unsigned short, (a2)), \
00075 ((vector unsigned short) ff_vmrglh ((vector signed short) (a1), (vector signed short) (a2))), \
00076 __ch (__bin_args_eq (vector float, (a1), vector float, (a2)), \
00077 ((vector float) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
00078 __ch (__bin_args_eq (vector signed int, (a1), vector signed int, (a2)), \
00079 ((vector signed int) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
00080 __ch (__bin_args_eq (vector unsigned int, (a1), vector unsigned int, (a2)), \
00081 ((vector unsigned int) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
00082 __altivec_link_error_invalid_argument ())))))))
00083
00084 #endif
00085
00086 #endif
00087
00088 #ifndef __MWERKS__
00089 #define const_vector const vector
00090 #else
00091 #define const_vector vector
00092 #endif
00093
00094 #endif