We rearrange the vector in several places, and we need a dedicated value of 0 for use with the built-in vec_perm . We were unable to find vec_zero() or the like, so we would like to know how we should deal with things.
Currently, the code uses two strategies. The first strategy is the vector load:
__attribute__((aligned(16))) static const uint8_t z[16] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 }; const uint8x16_p8 zero = vec_ld(0, z);
The second strategy is xor using a mask, which we intend to use:
__attribute__((aligned(16))) static const uint8_t m[16] = { 15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0 }; const uint8x16_p8 mask = vec_ld(0, m); const uint8x16_p8 zero = vec_xor(mask, mask);
We have not started the tests (yet), so we do not know if one of them is better. The first strategy uses a load of VMX, and it can be expensive. The second strategy avoids loading, but introduces a data dependency.
How do we get a VSX value of zero?