I have some code where I would like to perform a circular shift of the contents of an int4 by one word. Can this be done with some sort of shift operator, or something that is more efficient than 5 assignments?
int4 a; int4 b; b.x = a.x; a.x = a.y; a.y = a.z; a.z = a.w; a.w = b.x;
The above should only take 1 cycle, assuming the T ALU can do a MOV.
EDIT: The other assumption is, of course, that the Brook+ compiler is smart enough to make the IL that the CAL compiler can produce the good corresponding ISA.
You could always code this fairly simply in CAL/IL or CAL/ISA (of course, if AMD would ever get this code path working).
following one could be more efficient.
a=a.wxyz
genaganna, you code does this:
a.x = a.w
a.y = a.x
a.z = a.y
a.w = a.z
Which I don't think is what he wanted, for starters you are overwriting one of the values before you have a chance to write it back, correct?
But like I said above, either way this should only take 1 cycle if the compilers are good enough to handle it.
Originally posted by: ryta1203 genaganna, you code does this:
a.x = a.w
a.y = a.x
a.z = a.y
a.w = a.z
Which I don't think is what he wanted, for starters you are overwriting one of the values before you have a chance to write it back, correct?
it works fine. compiler generates appropriate code for such statements.
But like I said above, either way this should only take 1 cycle if the compilers are good enough to handle it.
a=a.yzwx
sorry previous one is lelf-cricular shift