[MPlayer-dev-eng] altivec patch 1/5: missing vec_splat in vec_clip

Luca Barbato lu_zero at gentoo.org
Wed Feb 8 20:24:23 CET 2006


Alan Curry wrote:
> The advantage to the current way is that the same macro can be used with any
> vector type whereas the long form initializer {x,x,x,x,x,x,x,x} would only be
> good for shorts. vec_clip won't be so neatly generalized anymore. I assume
> any such modifications should be confined within #if GCC (or a check added to
> configure, to #define HAVE_BROKEN_VECTOR_LITERALS)
> 

Ugly but working macro, please benchmark it against load&splat.

#define __un_args_eq(xtype, x)                                          \
        __builtin_types_compatible_p (xtype, __typeof__ (x))

#define __ch(x, y, z)   __builtin_choose_expr (x, y, z)


#define AVV_SPLAT(a)\
	__ch (__un_args_eq (unsigned int, (a)),\
	(vector unsigned int)AVV(a,a,a,a),\
	__ch (__un_args_eq (unsigned short, (a)),\
	(vector unsigned short)AVV(a,a,a,a,a,a,a,a),\
	__ch (__un_args_eq (unsigned char, (a)),\
	(vector unsigned char)AVV(a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a),\
	__ch (__un_args_eq (signed int, (a)),\
	(vector signed int)AVV(a,a,a,a),\
	__ch (__un_args_eq (signed short, (a)),\
	(vector signed short)AVV(a,a,a,a,a,a,a,a),\
	__ch (__un_args_eq (signed char, (a)),\
	(vector signed char)AVV(a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a),\
	__ch (__un_args_eq (float, (a)),\
	(vector float)AVV(a,a,a,a),\
	__builtin_altivec_compiletime_error ("avv_splat"))))))))

> So is it a deliberate but undocumented difference? Has it been discussed on
> gcc's mailing list at any point? I've learned that when I think I've found a
> compiler bug, I should think again...

There is a bug, you have to choose where, I rather consider gcc-apple
wrong since I experienced other problems with it long ago, but it's just
a matter of taste

lu

-- 

Luca Barbato

Gentoo/linux Developer		Gentoo/PPC Operational Leader
http://dev.gentoo.org/~lu_zero




More information about the MPlayer-dev-eng mailing list