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

Alan Curry pacman at TheWorld.com
Thu Feb 9 01:43:27 CET 2006


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.




More information about the MPlayer-dev-eng mailing list