Hi,I have looked through all the intrinsics for the Helium and can not find what would swap the values in the vector. As I understand it, this can only be done by loading/storing into/from memory. Can you please tell me, am I right, or is there a special intrinsic for the swap?Regards,Yevhenii
Did not work with MVE, but:
What do you mean by swap?
ABCD => BADC ?
You might do this with predicates and shift (if the vector in total can be shifted).
ABCD => DCBA ?
Are you looking for VREV, VREV16, VREV32, VREV64 MVE instruction?
They reverse bytes in a vector, e.g.
uint8x16_t a;
vrev32q_u8(a);
Saw these also, but they act on elements, not vectors right?You cannot swap elements inside a vector with a single instruction, right? (Guess that's what the OP asks for.)
So a vector with:11223344 | 55667788 | 99aabbcc | ddeeff00
becomes after a (which?) REVx
44332211 | 88776655 | ccbbaa99 | 00ffeedd
and not
ddeeff00 | 99aabbcc | 55667788 | 11223344
Hi 42Bastian,I mean swap ABCD in several variations:ABCD => BACD or BADC or CBAD or ...Regards,Yevhenii
But you mean elements, right?So when writing ABCD, you mean a vector of four 32bit elements.
Yes
VREVx instructions do reverse the byte order in one vector register, for example,
VREV64.8 Q0, Q1
Q1: 11223344 55667788 | 99aabbcc ddeeff00
Q0:
88776655 44332211 | 00ffeedd ccbbaa99
but there is no VREV128 or simply VREV MVE instruction (unlike NEON)