[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: altivec: how to load a scalar.



>
>However, I need one thing to get my algorithm working: I need to load a
>scalar into a vector register and zero all other elements in the vector.
>It does not matter where in the vector the scalar element ends up.
>
>I looked at the lvewx instruction that does exactly that, however the
>values at the positions in the vector that is not occupied by the scalar
>are undefined after the load, and not zero.
>

If you have a zero vector handy, you could use vsel to create a new 
vector with 3 elements selected from the zero vector and the one 
desired element from the other vector.



-- 

Nicholas Coult, Ph.D.,  web: http://melby.augsburg.edu/~coult
Assistant Professor, Department of Mathematics, Augsburg College
coult@augsburg.edu, phone:  (612) 330-1064 office: Science Hall 137B