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