[MPlayer-dev-eng] [PATCH] altivec fixes, part 2: missing vec_splat

Guillaume POIRIER poirierg at gmail.com
Tue Feb 7 13:34:41 CET 2006


Hi,

On 2/7/06, Diego Biurrun <diego at biurrun.de> wrote:
> On Mon, Feb 06, 2006 at 04:34:50PM -0500, Alan Curry wrote:
> > Diego Biurrun writes the following:
> > >
> > >On Mon, Feb 06, 2006 at 01:28:02AM -0500, Alan Curry wrote:
> > >> The vec_clip() macro didn't work correctly because it didn't vec_splat() its
> > >> constants.
> > >
> > >Please elaborate...
> >
> > As modified by me, it reads:
> >
> > #define vec_clip(x) \
> >   vec_max (vec_min (x, vec_splat((typeof(x))AVV(235),0)), \
> >            vec_splat((typeof(x))AVV(16),0))
> >
> > This creates a vector full of 235's and a vector full of 16's, and uses min
> > and max to clamp all components the x vector between 16 and 235. Without the
> > vec_splat, the constant vectors generated by AVV() are {16,0,0,0,...} and
> > {235,0,0,0,...} so the first element of the result is correct, and the rest
> > are all 0.
> >
> > Maybe the behavior of AVV() is compiler-dependent; mine is
> >   gcc version 3.3.5 (Debian 1:3.3.5-13)
> >
> > All other uses of the AVV() macro with a single non-zero argument are
> > surrounded by vec_splat(...,0) which makes them work around this compiler
> > bug/feature.
>
> Can you point me to some documentation about vec_splat?  The best I
> could come up with was

Google is your friend:
http://developer.apple.com/hardware/ve/instructions/vec_splat.html
http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.1/gcc/PowerPC-AltiVec-Built_002din-Functions.html

;-P

Guillaume
--
Just because code is syntactically "valid" GNU C doesn't mean gcc can
always compile it.
  Steven Bosscher - 2005-01-01
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203#c14
---
MPlayer's doc isn't up-to-date. Visit my updated mirror here:
http://tuxrip.free.fr//MPlayer-DOCS-HTML/en/
http://tuxrip.free.fr//MPlayer-DOCS-HTML/fr/




More information about the MPlayer-dev-eng mailing list