Hello, all.
In my calculation, i need to change sign of the odd elements of
sInt16 vector, i.e. take the original
vSInt16 v // containing s0, s1, s2, s3, s4, s5, s6, s7,
and convert in into
vSInt16 v_inverted // containing s0, -s1, s2, -s3, s4, -s5, s6, -s7
I am using such vector to perform msum later.
Currenty i am using three instruction approach, using two
additional pre-created vector.
It is something like this:
where v_One16 is vSInt16 containing 1 in each element, and maskIm
is vSInt16 containging ( 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000,
0xFFFF, 0x0000, 0xFFFF );
First step is to get one's complement
Second is to add one (thus changing sign to all elements)
Third is select even element from original vector and odd from
inverted
Could this be done using less instructions or less addidional
registers?
Thank you.
You can just subtract from zero to get the sign inverted vector - you
would save one instruction and could lose the v_One16 vector but
you'd need a zero vector (these usually come for free though).