2003-05-21 19:50:57 +02:00
|
|
|
/*
|
|
|
|
* gcc fixes for altivec.
|
2005-12-17 19:14:38 +01:00
|
|
|
* Used to workaround broken gcc (FSF gcc-3 pre gcc-3.3)
|
2003-05-21 19:50:57 +02:00
|
|
|
* and to stay somewhat compatible with Darwin.
|
2006-09-10 16:02:42 +02:00
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2006-09-10 16:02:42 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 17:30:46 +02:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2006-09-10 16:02:42 +02:00
|
|
|
*
|
2006-10-07 17:30:46 +02:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2006-09-10 16:02:42 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-10-07 17:30:46 +02:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-09-10 16:02:42 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2003-05-21 19:50:57 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GCC_FIXES_
|
|
|
|
#define _GCC_FIXES_
|
|
|
|
|
|
|
|
#ifdef HAVE_ALTIVEC_H
|
|
|
|
#include <altivec.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_DARWIN
|
2004-02-28 16:03:53 +01:00
|
|
|
# ifndef __MWERKS__
|
|
|
|
# define AVV(x...) (x)
|
|
|
|
# else
|
|
|
|
# define AVV
|
|
|
|
# endif
|
2006-04-07 14:40:28 +02:00
|
|
|
#define REG_v(a) asm ( #a )
|
2003-05-21 19:50:57 +02:00
|
|
|
#else
|
2006-04-07 14:40:28 +02:00
|
|
|
|
2003-05-21 19:50:57 +02:00
|
|
|
#define AVV(x...) {x}
|
2006-04-07 14:40:28 +02:00
|
|
|
|
|
|
|
#if (__GNUC__ < 4)
|
|
|
|
# define REG_v(a)
|
2006-04-16 05:40:04 +02:00
|
|
|
#else
|
|
|
|
# define REG_v(a) asm ( #a )
|
2006-04-07 14:40:28 +02:00
|
|
|
#endif
|
|
|
|
|
2005-12-17 19:14:38 +01:00
|
|
|
#if (__GNUC__ * 100 + __GNUC_MINOR__ < 303)
|
2003-05-21 19:50:57 +02:00
|
|
|
|
|
|
|
/* This code was provided to me by Bartosch Pixa
|
|
|
|
* as a separate header file (broken_mergel.h).
|
|
|
|
* thanks to lu_zero for the workaround.
|
|
|
|
*
|
|
|
|
* See this mail for more information:
|
|
|
|
* http://gcc.gnu.org/ml/gcc/2003-04/msg00967.html
|
|
|
|
*/
|
|
|
|
|
2003-07-29 12:26:34 +02:00
|
|
|
static inline vector signed char ff_vmrglb (vector signed char const A,
|
2005-12-22 02:10:11 +01:00
|
|
|
vector signed char const B)
|
2003-05-21 19:50:57 +02:00
|
|
|
{
|
|
|
|
static const vector unsigned char lowbyte = {
|
2005-12-22 02:10:11 +01:00
|
|
|
0x08, 0x18, 0x09, 0x19, 0x0a, 0x1a, 0x0b, 0x1b,
|
|
|
|
0x0c, 0x1c, 0x0d, 0x1d, 0x0e, 0x1e, 0x0f, 0x1f
|
2003-05-21 19:50:57 +02:00
|
|
|
};
|
|
|
|
return vec_perm (A, B, lowbyte);
|
|
|
|
}
|
|
|
|
|
2003-07-29 12:26:34 +02:00
|
|
|
static inline vector signed short ff_vmrglh (vector signed short const A,
|
2005-12-22 02:10:11 +01:00
|
|
|
vector signed short const B)
|
2003-05-21 19:50:57 +02:00
|
|
|
{
|
|
|
|
static const vector unsigned char lowhalf = {
|
2005-12-22 02:10:11 +01:00
|
|
|
0x08, 0x09, 0x18, 0x19, 0x0a, 0x0b, 0x1a, 0x1b,
|
|
|
|
0x0c, 0x0d, 0x1c, 0x1d, 0x0e, 0x0f, 0x1e, 0x1f
|
2003-05-21 19:50:57 +02:00
|
|
|
};
|
|
|
|
return vec_perm (A, B, lowhalf);
|
|
|
|
}
|
|
|
|
|
2003-07-29 12:26:34 +02:00
|
|
|
static inline vector signed int ff_vmrglw (vector signed int const A,
|
2005-12-22 02:10:11 +01:00
|
|
|
vector signed int const B)
|
2003-05-21 19:50:57 +02:00
|
|
|
{
|
|
|
|
static const vector unsigned char lowword = {
|
2005-12-22 02:10:11 +01:00
|
|
|
0x08, 0x09, 0x0a, 0x0b, 0x18, 0x19, 0x1a, 0x1b,
|
|
|
|
0x0c, 0x0d, 0x0e, 0x0f, 0x1c, 0x1d, 0x1e, 0x1f
|
2003-05-21 19:50:57 +02:00
|
|
|
};
|
|
|
|
return vec_perm (A, B, lowword);
|
|
|
|
}
|
2005-12-17 19:14:38 +01:00
|
|
|
/*#define ff_vmrglb ff_vmrglb
|
|
|
|
#define ff_vmrglh ff_vmrglh
|
|
|
|
#define ff_vmrglw ff_vmrglw
|
2003-05-21 19:50:57 +02:00
|
|
|
*/
|
|
|
|
#undef vec_mergel
|
|
|
|
|
|
|
|
#define vec_mergel(a1, a2) \
|
|
|
|
__ch (__bin_args_eq (vector signed char, (a1), vector signed char, (a2)), \
|
2003-07-29 12:26:34 +02:00
|
|
|
((vector signed char) ff_vmrglb ((vector signed char) (a1), (vector signed char) (a2))), \
|
2003-05-21 19:50:57 +02:00
|
|
|
__ch (__bin_args_eq (vector unsigned char, (a1), vector unsigned char, (a2)), \
|
2003-07-29 12:26:34 +02:00
|
|
|
((vector unsigned char) ff_vmrglb ((vector signed char) (a1), (vector signed char) (a2))), \
|
2003-05-21 19:50:57 +02:00
|
|
|
__ch (__bin_args_eq (vector signed short, (a1), vector signed short, (a2)), \
|
2003-07-29 12:26:34 +02:00
|
|
|
((vector signed short) ff_vmrglh ((vector signed short) (a1), (vector signed short) (a2))), \
|
2003-05-21 19:50:57 +02:00
|
|
|
__ch (__bin_args_eq (vector unsigned short, (a1), vector unsigned short, (a2)), \
|
2003-07-29 12:26:34 +02:00
|
|
|
((vector unsigned short) ff_vmrglh ((vector signed short) (a1), (vector signed short) (a2))), \
|
2003-05-21 19:50:57 +02:00
|
|
|
__ch (__bin_args_eq (vector float, (a1), vector float, (a2)), \
|
2003-07-29 12:26:34 +02:00
|
|
|
((vector float) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
|
2003-05-21 19:50:57 +02:00
|
|
|
__ch (__bin_args_eq (vector signed int, (a1), vector signed int, (a2)), \
|
2003-07-29 12:26:34 +02:00
|
|
|
((vector signed int) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
|
2003-05-21 19:50:57 +02:00
|
|
|
__ch (__bin_args_eq (vector unsigned int, (a1), vector unsigned int, (a2)), \
|
2003-07-29 12:26:34 +02:00
|
|
|
((vector unsigned int) ff_vmrglw ((vector signed int) (a1), (vector signed int) (a2))), \
|
2003-05-21 19:50:57 +02:00
|
|
|
__altivec_link_error_invalid_argument ())))))))
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CONFIG_DARWIN */
|
|
|
|
|
2004-02-28 16:03:53 +01:00
|
|
|
#ifndef __MWERKS__
|
|
|
|
#define const_vector const vector
|
|
|
|
#else
|
|
|
|
#define const_vector vector
|
|
|
|
#endif
|
|
|
|
|
2003-05-21 19:50:57 +02:00
|
|
|
#endif /* _GCC_FIXES_ */
|