Generating a mask vector (altivec)

3 posts / 0 new
Last post
salass00
salass00's picture
Offline
Last seen: 6 months 1 week ago
Joined: 2011-02-03 11:27
Generating a mask vector (altivec)

In an altivec optimised function I'm writing I want to mask out some of the bytes read.

To generate the mask vector I was going to use:
mask = vec_sld(vec_splat_u8(-1), vec_splat_u8(0), 16 - remains);

but it turns out that you have to use a literal as the last parameter to vec_sld().

If anyone can suggest a method to efficiently generate a vector with the first x bytes set to 0xff and the others set to 0x00 then it would help me a lot.

jabirulo
jabirulo's picture
Offline
Last seen: 2 weeks 4 days ago
Joined: 2013-05-30 00:53
Re: Generating a mask vector (altivec)

Maybe here
https://patches.videolan.org/patch/12549/
an searching for 'vec_sld' can help you.

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

salass00
salass00's picture
Offline
Last seen: 6 months 1 week ago
Joined: 2011-02-03 11:27
Re: Generating a mask vector (altivec)

No help there that I can see.

I could get around the literal value requirement in by either doing multiple vec_sld() calls in a loop or by doing a switch with all possible values for remains but neither of these solutions will be very efficient.

For now I've solved the problem by generating the mask vector in memory in advance.

Log in or register to post comments