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

altivec: how to load a scalar.




Hello Nicholas,

I'm trying to adapt my codegenerator to AltiVec code, so I have taken your
codes as a starting point to get a running start.

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.

Do you know how to solve this problem efficiently? First zeroing the
vector would still leave undefined but bounded zeros, whatever that would
amount to.

Another question: I thought about using vxor to zero a register instead of
loading -0.0 into it. Do you have any thoughts on that?

Thanks,

Peter.