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

Luca Barbato lu_zero at gentoo.org
Thu Feb 9 07:39:42 CET 2006


Alan Curry wrote:
> Luca Barbato writes the following:
>> #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"))))))))
> 
> I'm not sure I understand how you intend that to be used. Since it depends on 
> the type of its argument, which is going to be an integer constant
> expression, you can't use it as
>   (vector signed short)AVV_SPLAT(1)
> because the 1 is an int, so you get a vector signed int full of 1's, cast to
> vector signed short, which means you end up with {0,1,0,1,0,1,0,1}. It works
> this way:
>   (vector signed short)AVV_SPLAT((short)1)
> which doesn't look like much of an advantage.

use typeof in clip and we are almost done probably.

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